How Does Elevar Server-Side GA4 Attribution Work?

Overview

Follow this guide to learn how Elevar Server-Side Google Analytics 4 attribution works!


Google Analytics 4

Key GA4 Cookie Values:

GA4 uses cookies to link user interactions to the correct user profile and session. The primary cookies involved are:

  • _ga (stored via _elevar__ga)
  • _ga_XXXX (stored via _elevar__ga_XXXX)

These cookies enable GA4 to identify and maintain the user’s session across different interactions.

GA4 Parameters for Attribution:

GA4 attributes user interactions to various marketing channels using URL query parameters and referrer information. These parameters, referred to as "GA parameters," include:

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

These parameters are captured and stored in _elevar_visitor_info within order notes for tracking purposes.

Elevar DataLayer Management:

Elevar’s dataLayer is designed to mirror GA4’s parameter processing.

Handling URL Parameters:

  • If URL contains any utm parameters or a gclid, Elevar will clear all previously stored GA4 parameters from local storage and update it with the new parameters from the URL.

Handling Referrer Information:

  • If the URL does not contain utm parameters or gclid, but an external referrer is present (e.g., google.com from an organic listing), Elevar will clear the existing GA4 parameters from local storage and update it with the referrer information.

No Change Scenario:

  • If there are no utm parameters, gclid, or external referrer, Elevar does not make any changes to the local storage. Existing GA4 parameters from previous sessions may remain unchanged.

What do we send with the transaction to GA4?

When processing orders for attribution in Google Analytics 4 (GA4), several scenarios are considered:

Attribution Overrides:

  • If the order matches any attribution overrides in the destination settings, GA4 cookies are sent along with the outlined attribution information.

Existing GA Cookies:

  • If the required GA cookies are available for the order, GA4 cookies and any stored GA4 parameters are sent. This ensures accurate channel attribution, even if previous session hits were blocked. If session hits were not blocked, GA4 will link the purchase hit to the user's other session hits. However, if no GA4 parameters are available, the order may appear as direct/none in GA4, unless GA4 has previous attribution information not available elsewhere.

Missing GA4 Cookies, but with Parameters:

  • In cases where GA4 cookies are absent but GA4 parameters are present, the order is sent with the parameters, albeit with a generated cookie value. This method ensures correct channel attribution but generates a new user and session in GA4.

No GA4 Cookies or Parameters:

  • If neither GA4 cookies nor parameters are available, the system checks Shopify's "landing_site" to see if any GA4 parameters were captured. If found, these parameters are sent with the order along with a generated cookie value. However, without GA4 cookies or parameters, the order will result in a new user and session in GA4, attributed to direct/none. Utilizing Shopify's landing_site as a fallback increases the chance of attributing the order to a channel.