Back to resources

Customize your experience with Graviti settings

Implementing tracking scripts on Graviti system

How do l create tracking scripts?


The membership system uses tracking scripts to collect user data that can be used to improve the user experience, marketing, product development, and customer service. The data collected includes login frequency, content consumption, engagement, demographics, and location.

Tracking providers include Google Analytics, Microsoft Clarity, Fathom Analytics, Matombo, Mix Panel, and more.

Below are the sample scripts for each provider outlined above:

Google Analytics sample script

```

<!-- Global site tag (gtag.js) - Google Analytics -->

<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

  gtag('config', 'GA_MEASUREMENT_ID');

</script>

```

 

Microsoft clarity sample script

```

<script type="text/javascript">

(function(c,l,a,r,i,t,y){

c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};

t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;

y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);

})(window, document, "clarity", "script", "CLARITY_MEASUREMENT_ID");

</script>

```

 

Fathom Analytics sample script

```

<script src="https://cdn.usefathom.com/script.js" site="FATHOM_SITE_ID" defer></script>

```

 

Matomo sample script

```

<!-- Matomo Tag Manager -->

<script>

  var _mtm = window._mtm = window._mtm || [];

  _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});

  var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];

  g.type='text/javascript'; g.async=true; g.src='https://MATOMO_URL/matomo.js'; s.parentNode.insertBefore(g,s);

</script>

<!-- End Matomo Tag Manager -->

<noscript><p><img src="https://MATOMO_URL/matomo.php?idsite=MATOMO_SITE_ID&amp;rec=1" style="border:0;" alt="" /></p></noscript>

```

 

Mix panel sample script

<script>

(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");

a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+

'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];

f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){

var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(

Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:

d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);

b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+

".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");

for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);

mixpanel.init("MIXPANEL_PROJECT_TOKEN");

</script>

```

 

HOW DO I ADD TRACKING SCRIPTS?

To add the tracking scripts, click on the “Add” button.


Details required when adding the tracking script, are:

  • Provider: the provider’s details.
  • Target page: the target page details.
  • Script content: the script content details.

Once all the details have been added, click on the “Submit” button to save.

The back navigation button is for the admin to be able to navigate back to the module or section main page.


On the tracking scripts main page, you can view the displayed data columns, which consist of:

  • Provider: the name of the tracking script provider.
  • Target page: the target page details.
  • Enabled: an indication if the tracking script is enabled or not.
  • Date updated: the date on which the tracking script was updated.
  • Updated by: the full name of the system user who made the changes to the tracking script.
  • Action: per tracking script, on the “Action” dropdown, you have options to:
    • View: you can view the tracking script.
    • Edit: you can update the tracking script.
    • Enable or disable: you can activate or deactivate the tracking script.
    • Remove: you can delete the tracking script

The back navigation button is for the admin to be able to navigate back to the module or section main page.




Related topics