I would like to know how many people have done a particular operation. When that operation is performed, you can call Google Analytics directly from the JavaScript program you wrote and record the event.
This function can be used in many elaborate ways, but if you simply want to count the number of times, this is all you need. ts
- The “harvest” part is an easy-to-understand event name that you have given yourself.
- I think JavaScript people can work without the
window.
- This is what it looks like on the Engagement page of Google Analytics
- You can trace it back from there to see when and how much it was used.
detailed account
- This gtag function is defined in the code that you are instructed to paste into the HTML when you first set up Google Analytics
- dataLayer is just adding to the list.
- Maybe there’s a system that periodically checks the contents of this list and sends it to the server. html
Manual Description
- The third argument can be used to send a variety of additional information.
- I was confused, thinking something had to be set up properly, but if you just want to count the number of times, you can omit it.
- Measuring Google Analytics Events | Universal Analytics for the Web (gtag.js) js
About adding properties
- I was confused because I thought a property was an “attribute”, but it seems to be a Google Analytics term for a unit of information that summarizes information that can have multiple units directly under an account.
- If you create a new web service, you can add properties to it.
TypeScript will generate an error if the type of gtag is unknown, so declare it as follows index.ts
I was confused as to whether I had to set up the event, but it looks like I don’t have to.
This page is auto-translated from [/nishio/Google Analyticsで何でもカウント](https://scrapbox.io/nishio/Google Analyticsで何でもカウント) using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I’m very happy to spread my thought to non-Japanese readers.