Zapier integration with Google Analytics 4 (GA4)

  • 3 May 2023
  • 5 replies
  • 2078 views

Userlevel 1

Sunset date for Universal Analytics is quickly approaching and I don’t see a native integration in GA4 as yet. Supposedly, it’s still work in progress, but this isn’t leaving much time to get things reconfigured.

I created a workaround using a “Custom Request” webhook if anyone is interested. Tested and works perfectly:

 

Method: Post

URLhttps://www.google-analytics.com/mp/collect?api_secret=[API-SECRET-GOES-HERE]&measurement_id=[STREAM-ID-GOES-HERE]

Data:

{ "client_id": "SOURCE-DATA-GOES-HERE",

"user_id": "SOURCE-DATA-GOES-HERE",

"non_personalized_ads": false,

"events": [ { "name": "EVENT-NAME", "params":

{ "EVENT-PARAM-1": "SOURCE-DATA-VARIABLE-GOES-HERE",

"EVENT-PARAM-2": "SOURCE-DATA-VARIABLE-GOES-HERE",

"EVENT-PARAM-3": "SOURCE-DATA-VARIABLE-GOES-HERE",

"EVENT-PARAM-4": "SOURCE-DATA-VARIABLE-GOES-HERE"

 } } ] }

Unflatten: Yes

 

Pass as many variables as you wish. See GA4 measurement protocol for documentation and references to values.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Does yours show up in realtime reports? Documentation says you have to add a session id and the “engagement_time_msec" for it to show in standard reorts such as realtime?

If you are adding that what are you using to generate the time?

Userlevel 1

Sorry for the late reply. Yes, these events appear in the Realtime reports. I just send a session ID of ‘1’.

I’m still not clear how you set this up.

 

Where would you set up a “Custom Request”?

Hi there, 

Do you know what happens if you set a client ID which GA4 doesn’t recognize? I’m wondering if we can use this to track our lead ads in GA4. There’s obviously no client id for users who engage with lead ads directly as they’ve never visited the site so I’m curious to know if it’s possible to just generate a client ID providing you stick to the same format. Or will the POST simply fail as GA4 doesn’t have a record of that specific client ID.

Or if you know of an easier way to track lead ads then please let me know! We want to track how those leads are progressing down our pipeline in GA4 like we do for our other leads.

Mike.

 

Hi there, 

Do you know what happens if you set a client ID which GA4 doesn’t recognize? I’m wondering if we can use this to track our lead ads in GA4. There’s obviously no client id for users who engage with lead ads directly as they’ve never visited the site so I’m curious to know if it’s possible to just generate a client ID providing you stick to the same format. Or will the POST simply fail as GA4 doesn’t have a record of that specific client ID.

Or if you know of an easier way to track lead ads then please let me know! We want to track how those leads are progressing down our pipeline in GA4 like we do for our other leads.

Mike.

I have the same question. We want to track an event after someone register into certain course on Learndash platform (https://zapier.com/apps/learndash/integrations).