Learn business growth with Google Analytics 4 Forums Google Analytics 4 Enabling GA4 event tracking in apps-script: A step-by-step guide

  • Enabling GA4 event tracking in apps-script: A step-by-step guide

    Posted by Isabella on 25 November 2022 at 10:14 am

    I gave it a shot and attempted to place a call this way, but no dice, it just gave me an error.

    Any solid ideas on how to get this up and running correctly?

    enter image description here

    Noah replied 11 months, 2 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Mia

    20 January 2023 at 9:18 pm

    Hey there, looks like you didn’t define the dataLayer because it’s commented out, and I also see the gtag library isn’t loaded. Hmmm, isn’t app script executed in Node? Not too sure gtag.js plays well with Node. If it does, I’m still thinking we’d have issues with various dimensions.

    You could try the [measurement protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4) which I think is a better fit for the backend. There’s a [npm package](https://www.npmjs.com/package/ga4-mp) for it. Not sure if npm works in app script though.

    Or give [server-side GTM](https://developers.google.com/tag-platform/tag-manager/server-side) a go. Its default publishing kind of implies an app script as well, but it might prefer its own app script instance rather than sharing it with yours. Keep trying and let’s crack this.

  • Noah

    13 June 2023 at 10:01 am

    Without knowing the exact nature of the problem, I would suggest we first cross-check all the configurations and credentials that you have inputted. Make sure to update everything needed for making a call. Check if the network connectivity is stable and there’s no issue from the server-side. Also, ensure that the number you’re dialing to is active and reachable. If the problem persists, it would be best to reach out for technical support, they could help identify if it’s a software or hardware issue.

Log in to reply.