How does Elevar Server-Side GA Attribution Work?

How does Elevar’s SS GA Attribution Work?

[How does Elevar decide what to capture in order notes and what to send to GA?]

If you are using one of Elevar's server side destinations, you will notice some information stored in order notes within Shopify - a variety of click IDs, cookie values, and utm parameters.

Let's zoom in on Google Analytics specifically. GA uses a couple of cookie values to associate hits with the correct user and session that we always capture when available:

  • _ga (stored via _elevar__ga) - used by Universal Analytics and GA4
  • _ga_XXXX (stored via _elevar__ga_XXXX) - used by GA4

GA also uses query parameters in the URL and the referrer to attribute hits to various channels. We'll call the contents of this list "GA parameters" going forward. These are stored via _elevar_visitor_info in order notes:

  • utm_source
  • utm_medium
  • utm_campaign
  • utm_content
  • utm_term
  • gclid
  • referrer

Elevar's dataLayer mimics Google's processing to store the GA parameters for the session and then push them to order notes:

  1. If there are any utms or a gclid in the URL, we clear out all GA parameters we previously stored in local storage, and store the new ones from the URL
  2. If there are no utms and no gclid, but there is an external referrer (for example, google.com from an organic listing), we clear out all GA parameters we previously stored in local storage, and store the referrer
  3. If there are no utms, gclid, or external referral, nothing is changed in local storage. We may have GA parameters stored from a previous session

What do we send with the transaction to GA?

  • If the order matches any attribution overrides in your destination settings, we send the GA cookies along with the attribution information you outlined
  • If we have the required GA cookies for the order, we send the GA cookies and any GA parameters we have stored.
    • This ensures the purchase is attributed to the correct channel, even if all other hits from the session were blocked.
    • If the session hits were not blocked, GA will stitch the purchase hit to the user's other session hits
    • If we have no GA parameters, this order will show up as direct/none in GA, unless GA has previous attribution information for the user that we do not have
  • If we do not have the required GA cookies, but do have GA parameters, we send the order with the parameters, but a generated cookie value.
    • This ensures the purchase is attributed to the correct channel, but it will create a new user and a new session in GA
  • If we do not have GA cookies or GA parameters, we will look to Shopify's "landing_site" (stores the user's first visited page) to see if Shopify was able to capture any GA parameters. If so, we send these parameters with the order along with a generated cookie value.
    • Without GA cookies or GA parameters, the order will create a new user and a new session in GA, along with attributing the order to direct / none. Falling back to Shopify's landing_site allows the possibility of attributing the order to a channel.