dev-nguyenhoanganh / personal-profile

The website introduces my journey to becoming a web developer
MIT License
1 stars 0 forks source link

Research about tag management system (Google Tag Manager) #4

Open dev-nguyenhoanganh opened 3 months ago

dev-nguyenhoanganh commented 3 months ago

Research about tag management systems GA (Google Analytics), SAS (Statistical Analysis System)

Output:

dev-nguyenhoanganh commented 3 months ago

What is GA (Google Analytics)

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.

How to add GA code into a React application

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>

https://github.com/DavidWells/analytics/tree/master/examples/react

Reference Documents

  1. Google Analytics | Demos & Tools
  2. [GA4] Analytics dimensions and metrics
  3. About custom dimensions and metrics
  4. Google Analytics width React
  5. Events measurement and parameters