Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: Use google measurement protocol for ecommerce events (enhanced compatibility with HTTP Events API) #17

Open
agcty opened this issue Jul 10, 2023 · 2 comments
Assignees

Comments

@agcty
Copy link

agcty commented Jul 10, 2023

Currently, the google managed component doesn't use the measurement protocol for tracking ecommerce events. However, it seems particularly useful for exactly that in server-side environments.

Current state

Right now, when using the HTTP Events API, the MC will return a few client fetch requests which you then have to manually execute on the client side, if you don't do that, the checkouts, etc won't be tracked.

Proposed solution

While you can definitely return the response object of the tracking call and forward it to the client, this seems a little sub-optimal as there is an actual API from Google that you can use for exactly this scenario (and only this scenario, the measurement protocol doesn't allow you to send pageviews for example). Instead of client.fetch, manager.fetch could be called with the ecommerce request payload. This would also be more resilient against ad blockers.

I know that a lot of other questions would have to be answered to assess if this is feasible. This issue is to identify what these are and to start a discussion about using the measurement protocol in general.

@ad-astra-via
Copy link
Contributor

Hello @agcty , and thanks for starting this discussion!

Right now, when using the HTTP Events API, the MC will return a few client fetch requests which you then have to manually execute on the client side, if you don't do that, the checkouts, etc won't be tracked.

To which client.fetch() calls are you referring to exactly please? I can see two: one is related to GA Audiences, and the other one for DoubleClick. Both, to my knowledge, could be ignored if you wish to go only serverside, and you should still be able to see data coming in in GA4. It will probably affect anything related to G Ads conversion tracking and retargeting, as these still rely on 3rd party cookies.

@kuba-orlik kuba-orlik assigned bjesus and unassigned ad-astra-via Sep 6, 2023
@agcty
Copy link
Author

agcty commented Feb 13, 2024

Sorry for the delayed response! Yes, there are two fetches that need to be called: GA Audiences and DoubleClick. However, I believe you also need to execute some client side code that the MC sends back for the event to be tracked successfully, the two fetches are not sufficient. Ideally, I wouldn't want to execute that code on the client (e.g via eval), I believe using the measurements api would solve that.

For more context, this is our use case:
We have a checkout page where a customer is redirected to after a successful payment. Ideally, we would use the HTTP Events API to track the purchase event when the success page is sending its response. We do this in conjunction with a cookie "collect" that is set to true when redirecting to the strip checkout and set to false when the user lands on the success page. This way, we make sure the purchase event is recorded exactly once. We also use a few other MCs such as TikTok and Facebook, both of which I believe are fully using their respective server side APIs. We don't experience issues there and tracking fully server side just works out of the box. Google however seems to be a special case and doesn't work, again because I think you actually need to run some client side code as well instead of just a fetch call.

I am not sure what to make of this because I think the MC would potentially need to be rearchitected in parts to use the Measurements Protocol. However this also poses challenged as not everything can be collected over the MP: https://developers.google.com/analytics/devguides/collection/protocol/ga4#full_server-to-server.

I guess you could work around that with blocking triggers and calling the Measurement Protocol directly yourself. Maybe you could even have a property in the MC that forces the MP in some cases. Again, don't know the best solution or if this is even worthy of discussing.

@kuba-orlik kuba-orlik assigned ad-astra-via and unassigned bjesus Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants