2

My website is built using Angular. The frontend pages are built using Angular SSR (server-side rendering). My checkout pages are using Angular, but not SSR. The issue is that once a user lands on an Angular SSR page and then proceeds to a checkout page, Google is dropping the session data. When I look at my Google Analytics reports, it appears that all traffic going to the checkout process is "organic", but in reality, it is not. The source (Google) remains but the medium is being dropped. Here is a full example:

  1. User visits www.example.com/my-product from a Google Ad (this is an Angular SSR page)
  2. In Google Analytics, this user is reported as coming from a "paid" ad
  3. User clicks "buy product" which starts the checkout process. The checkout process is not built using Angular SSR
  4. Google Analytics shows this user as "organic" traffic

Is there a way to let Google Analytics know this is the same user and website session?

I know one solution would be to convert the checkout to Angular SSR, but that is something I want to avoid if there is an alternative solution (i.e. passing a parameter to the checkout URL).

1 Answer 1

2

You didn't do enough debugging. A switch in attribution like that is only possible with complete session breakage. It's common when you either have checkout on a different TLD (top-level-domain) so the user id changes too or when something interferes with the referrer.

This happens a lot on shopify backend due to how they've implemented their checkout. And there are fixes for it.

Just to answer your question in bold:

  1. Yes, there is. Google keeps track of clients using the _ga cookie. Just make sure it's not being interfered with.

  2. As you may know, cookies are TLD-specific, so if TLD changes, you can't expect the ga library to be able to keep track of the client. What you do to mitigate it? In GTM (or directly in the ga lib), you set up cross domain tracking, here Simo goes deeper into the issue: https://www.simoahava.com/analytics/troubleshooting-cross-domain-tracking-in-google-analytics/

  3. Finally, there's a also a more elegant way of fixing the cookie issue with no hassle of cross-domain tracking: through your backend. Now the backend will have to store the _ga cookie and populate it on the first hit on the checkout page, which is how it's solved on shopify.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.