Forum Discussion

duahire's avatar
duahire
Adept
3 months ago

Google Tag Manager and Google Analytics Setup in Aurora platform

Hello Guys,

Anyone has setup the GTM and Google analytics in current version of Aurora Platform.

We tried with the pagescript which is not working for us.

IF anyone added implemented the same, then please let us know.

 

Thanks

Durgesh

  • duahire 
    this article may be able to help you
    https://developer.khoros.com/khorosauroradevdocs/docs/configurable-page-scripts

     

5 Replies

  • duahire 
    this article may be able to help you
    https://developer.khoros.com/khorosauroradevdocs/docs/configurable-page-scripts

     

  • Did that document resolve your problem? Curious because I'm working a project that needs to use google tags. TY, sara

  • duahire's avatar
    duahire
    Adept
    31 days ago

    sleslieActually that document works for me but we cannot use actual script provided by Google Tag manager. We need some modification. We need to modify in such way that script URL get included into the DOM

  • When we moved from Classic to Aurora, GTM & Analytics were removed, and it took us weeks to realize it (lesson learned).

    We ended up working with Khoros partner/Grazitti to get GTM and Google Analytics working in our Equinix Community, which is on Aurora. 

    I didn't hear anything when they implemented it on any issues. Maybe they'll chime in here? 

  • duahire  sleslie99  ShannonJ
    Here is how I think it will work to implement GTM on Aurora. Please correct me if I am wrong. Below is the Github code level implementation.

    Step 1:
    under res/pagescripts/, create a folder called "analytics" (res/pagescripts/analytics)

    Step 2:
    under res/pagescripts/, there should be a file called "groups.scripts.json", edit this file (if not exist, create it), 

    {
      "beforeInteractiveFirst": ["analytics"],
      "beforeInteractiveLast": [],
      "afterInteractive": [],
      "lazyOnLoad": []
    }

    Step 3:
    create "analytics.script.json" under res/pagescripts/analytics/

    {
      "id": "analytics",
      "assets": ["analytics.js"]
    }

    Step 4:
    create "analytics.js" under res/pagescripts/analytics/, replace GTM-XXXXXXXX with your own GTM-ID

    (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXXXX');

    Step 5:
    Commit and deploy.