Open dev-nguyenhoanganh opened 3 months ago
Google Analytics is a web analytics service offered by Google that tracks and reports website traffic and also mobile app traffic & events, currently as a platform inside the Google Marketing Platform brand.
The gtag.js
snippets for a Universal Analytics property and for a Google Analytics 4 property are fundamentally the same. Both snippets have the following structure:
<script async src="https://www.googletagmanager.com/gtag/js?id=<Some Property ID A>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<Some Property ID A>');
gtag('config', '<Some Property ID B>');
gtag('event', 'sign_up', { 'method': 'email' });
gtag('event', 'view_video', { 'send_to': '<Some Property ID B>' });
</script>
<Some Property ID A>
will begin with "AW-" or "DC-".
If this line is already present, it doesn’t need to be implemented a second time. gtag('config', '<Some Property ID A>')
: The property ID may represent measurement for different Google products, including a Universal Analytics property ("UA-XXXXXXXX"), a Google Analytics 4 property ("G-XXXXXXXX"), Google Ads ("AW-XXXXXXXX") or Floodlight ("DC-XXXXXXXX").gtag('event', 'sign_up', { 'method': 'email' })
: The gtag "event" directive will send an event. In snippets where multiple "config" directives are present for multiple properties, the event will be sent to all properties.
In this example, the "sign_up" parameter is the event name. The last parameter is an object that contains a set of event parameters. In this case, "method" is a parameter with a value of "email."https://github.com/DavidWells/analytics/tree/master/examples/react
Research about tag management systems GA (Google Analytics), SAS (Statistical Analysis System)
Output: