gtag ga4 server side: report conversion with gclid back to google ads
Asked Answered
S

0

8

How do I report conversion from gtag on server side back to google ads?

My current setup is that I report events from gtag back to google analytics 4 using unique userId (generated in my database and it's unique for each user)

    let data = {
        client_id: this.getDeviceId(),
        user_id: this.userId,
        events: [{
            name: eventName,
            params: props,
        }]
    }

    ... then send it as payload to the tracking url to the ga4 tracking url:
    https://www.google-analytics.com/mp/collect?measurement_id=...&api_secret=...

Now I launched google ads and want to report purchase and renewals as conversion.

So I imported my target event from GA4 to google ads as an offline event.

But to my understanding, in order to properly link the user back to google ads, I also need to pass gclid in gtag when I report the event/conversion, but how to do that?

Should I just add gclid as property in data? Is it documented anywhere?

I was using the below doc link in order to setup gtag tracking on the server: https://developers.google.com/analytics/devguides/collection/protocol/ga4/user-properties?client_type=gtag

Sidecar answered 1/8, 2022 at 0:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.