[{"data":1,"prerenderedAt":110},["ShallowReactive",2],{"legacy-question-e922d77f69e6b46d3c05b83b6b14cfb9":3,"legacy-question-author-koji-kadoma":83,"legacy-question-category-website-building":99},{"id":4,"title":5,"author":6,"body":7,"category":69,"date":70,"description":5,"extension":71,"locale":72,"meta":73,"navigation":74,"path":75,"seo":76,"slug":77,"stem":78,"tag":79,"updated":81,"__hash__":82},"legacyQuestions\u002F20210406000000-GridsomeでCloudflare Web Analyticsを使いたい.md","GridsomeでCloudflare Web Analyticsを使いたい","koji-kadoma",{"type":8,"value":9,"toc":64},"minimark",[10,15,19,22,33,36,39,42,49,53,56],[11,12,14],"h2",{"id":13},"indexhhtmlを用意してスクリプトを記述します","index.hhtmlを用意してスクリプトを記述します",[16,17,18],"p",{},"Gridsomeでは、Vue.jsと同じように自動生成のHTMLフォーマットだけでなく、ベースとなるHTML（index.htmlをオーバーライド）も設置できます。",[16,20,21],{},"src\u002Findex.htmlに、",[23,24,29],"pre",{"className":25,"code":27,"language":28},[26],"language-text","\u003C!DOCTYPE html>\n\u003Chtml ${htmlAttrs}>\n  \u003Chead>\n    ${head}\n  \u003C\u002Fhead>\n  \u003Cbody ${bodyAttrs}>\n    ${app}\n    ${scripts}\n    \u003C!-- Cloudflare Web Analytics -->\u003Cscript defer src='https:\u002F\u002Fstatic.cloudflareinsights.com\u002Fbeacon.min.js' data-cf-beacon='{\"token\": \"トークン\"}'>\u003C\u002Fscript>\u003C!-- End Cloudflare Web Analytics -->\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n","text",[30,31,27],"code",{"__ignoreMap":32},"",[16,34,35],{},"と書いて保存するだけでOKです。",[16,37,38],{},"後述のプラグインだと、HTMLのヘッダ要素にscriptを追加していますが、Cloudflare Web Analyticsではbodyタグの最後に記述するとあるので、そちらにした方が良いでしょう。",[16,40,41],{},"SPAモードのページ遷移もしっかりと計測されます。",[16,43,44],{},[45,46,48],"a",{"href":47},"\u002Fq\u002F6220d38fd4d82f9e82507d1dd95d591c\u002F","Gridsomeでデフォルトのindex.htmlを変更するには？",[11,50,52],{"id":51},"プラグインsecurizedplugin-cloudflare-analyticsを使いますトラックできません","プラグイン「@securized\u002Fplugin-cloudflare-analytics」を使います（=>トラックできません）",[16,54,55],{},"有志の方がGridsomeでCloudflare Web Analyticsを使えるようにするプラグインを用意してくれているのですが、そちらは計測ができませんでした。",[16,57,58],{},[45,59,63],{"href":60,"rel":61},"https:\u002F\u002Fgridsome.org\u002Fplugins\u002F@securized\u002Fplugin-cloudflare-analytics",[62],"nofollow","@securized\u002Fplugin-cloudflare-analytics",{"title":32,"searchDepth":65,"depth":65,"links":66},2,[67,68],{"id":13,"depth":65,"text":14},{"id":51,"depth":65,"text":52},"website-building","2021-04-06T03:00:00.000Z","md","ja",{},true,"\u002F20210406000000-gridsomecloudflare-web-analytics",{"title":5,"description":5},"e922d77f69e6b46d3c05b83b6b14cfb9","20210406000000-GridsomeでCloudflare Web Analyticsを使いたい",[80],"gridsome","2021-06-17T03:00:00.000Z","3swWrKtvG_DuJTubvkXABcoxnKLvfymb1-p8zUGZ3Ic",{"id":84,"title":85,"body":86,"date":90,"description":91,"extension":71,"locale":72,"meta":92,"name":95,"navigation":74,"path":96,"seo":97,"slug":6,"stem":6,"updated":90,"__hash__":98},"legacyAuthors\u002Fkoji-kadoma.md","Koji Kadoma",{"type":8,"value":87,"toc":88},[],{"title":32,"searchDepth":65,"depth":65,"links":89},[],"2021-04-01T00:00:00.000Z","Webエンジニアです。Javascript、PHP、Ruby、Dockerなどをメインで使っています。",{"image":93,"url":94},"https:\u002F\u002Fwww.codit.work\u002Fimgs\u002Favatar\u002Fkoji-kadoma.png","https:\u002F\u002Fkoji.pages.dev\u002F",null,"\u002Fkoji-kadoma",{"title":85,"description":91},"H1yaGicrsv1CzYTbFeEXQosuYx93lIutD3_XwXMhAFk",{"id":100,"title":101,"body":102,"date":90,"description":101,"extension":71,"locale":72,"meta":106,"navigation":74,"path":107,"seo":108,"slug":69,"stem":69,"updated":90,"__hash__":109},"legacyCategories\u002Fwebsite-building.md","Webサイト構築",{"type":8,"value":103,"toc":104},[],{"title":32,"searchDepth":65,"depth":65,"links":105},[],{},"\u002Fwebsite-building",{"title":101,"description":101},"h9jPLD2mzMm3L4sFN5qWSiSirySQQLdnxLhQcvw8VlQ",1783320301143]