Assigning Purchases to Other Users in Google Analytics

Sometimes, you want to assign specific user interactions to a different user.

There are many cases where you want to send an event for user X while user Y performs the action. But it’s important that you can save this information to the right user.

In our case, we ran into the use case where an RV owner needs to accept a booking. Only after the approval takes place do we consider this an actual purchase (transaction in GA). According to regular logic, the RV owner would get the purchase attributed to its session in Google Analytics. In the end, that user goes through the steps in the interface and confirms the transaction.

Marketing <> Google Analytics Logic

This doesn’t work for Marketing, though. We did our best to acquire the renter, and they’re the ones purchasing. According to Google Analytics, we’d fire an e-commerce purchase on behalf of the owner. What this messes up is channel attribution & performance measurement of our campaigns. In this case, the owner’s path is likely not touching any paid or true marketing channels but either direct or email.

In summary, the wrong user would get credit for the conversion, which could cause issues with our ROAS measurement of marketing channels.

Switching Client IDs & Leveraging User IDs

When Google Analytics is loaded, it will set the client ID value in the _ga cookies in your browser. This value (the client id) will be used to tie events → pageviews → sessions together and be seen as one user (in combination with the userId value, obviously).

So what we’re doing is pretty simple to change this behavior:

  1. Whenever a user goes through the checkout funnel and creates a user account, we save their Google Analytics Client IDs (for GA4 and UA) to their profile.
  2. When user X confirms the purchase, we’re sending an event to Tag Manager with the purchase context, including the impacted data from user Y.
  3. Instead of directly firing the hit to Google Analytics, we swap out the client ID and userID from user X to user Y so that the actual purchase will get attributed to that hit. You need to mimic a session ID.
  4. Google Analytics will now stitch this purchase to user Y instead of user X. You can choose for yourself what you want to fire for user Y.

Resources

→ Setting the Client ID in Google Analytics 4

→ Setting the Client ID in Google Analytics with gtag.js

User ID

Where possible, make sure that you’re already sending a userID to Google Analytics to ensure that the interactions can be truly tied back to the same user.

Help me out, share this article:Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Email this to someone
email
Share on Facebook
Facebook
Buffer this page
Buffer
Learnings from Managing Marketing Budgets
The Concept of Input Metrics for SEO

Leave a Reply

Your email address will not be published / Required fields are marked *