This document details the set-up for Google Analytics GA4 e-commerce tracking in the Checkout Next Gen, as well as tips for measuring checkout interactions with Google Analytics and Web Activity.

    Google e-commerce tracking events are built into the checkout. Tracking these events is easy with Google Tag Manager and Google Analytics.

    This document assumes you have a working knowledge of Google Analytics and Google Tag Manager. Please contact your Account Manager if you require help from Abacus in setting up tracking.

    To set up and add e-commerce tracking, navigate to:

    Configuration > Brands> YOUR BRAND > Branding > Site Branding tab

    Checkout_V2_Branding

    Add the GTM ID

    Add your GTM ID to the field - this will load your GTM container to the Checkout and Middleware applications.

    Adding dataLayer items needed to support e-commerce tracking

    Checkout_V2_Text_assets

    The Text Asset called Metadata Extraction - Checkout contains the JavaScript variables that are used for the e-commerce tracking.

    These fields MUST be present for the e-commerce tracking to work.

    Add events to GTM

    An example GTM container is attached at the bottom of this article. This can be loaded into your GTM container, or a separate container, and used to copy events. More information on importing containers is available on the GTM documentation site.

    This will load the following items into GTM:

    • Tags:
      • GA4 - add_billing_info (custom)
      • GA4 - add_payment_info
      • GA4 - add_shipping_info
      • GA4 - add_to_cart
      • GA4 - begin_checkout
      • GA4 - purchase
    • Triggers:
      • GA4 - add_billing_info (custom)
      • GA4 - add_payment_info
      • GA4 - add_shipping_info
      • GA4 - add_to_cart
      • GA4 - begin_checkout
      • GA4 - purchase
    • Variables:
      • GA4 - Ecommerce - currency
      • GA4 - Ecommerce - items
      • GA4 - Ecommerce - shipping
      • GA4 - Ecommerce - tax
      • GA4 - Ecommerce - transaction_id
      • GA4 - Ecommerce - value
      • GA4-ID

    Event details 

    GA4 eventData element  Populated withEvent fires:
    begin_checkout currency The currency applicable to the current checkout, in 3-letter ISO 4217 format.

    begin_checkout fires on:

    On entry to Order Type page (gift/individual)

    On entry to checkout - if not previously fired on Order Type page

    Note: begin_checkout does not fire sign-in / create account.

     

     

      value The gross value  of all items in checkout (excluding tax and shipping).  
      items Represents a container for all variant items in checkout. Each individual variant is represented with the data elements as listed below as ‘items[…]…’.  
      items[…].item_id The unique ADvance variant id  for the variant being represented in checkout.  
      items[…].item_name

    The name  for the variant being represented by this item in checkout. The value consists of:

    VariantName

    Or 

    Variant Display Name  - if added.

     
      items[…].item_brand The brand name entered into the text asset - Metadata Extraction - Checkout  
      items[…].currency The currency  that is applicable to the variant in checkout. This value will match the ‘currency’ value at the parent level of this event.  
      items[…].price The gross value  of the variant being represented by this item in checkout (excluding tax and shipping).  
      items[…].quantity The quantity  of the variant in checkout.  
      items[…].tax The Tax applied to the variant - at this stage of the checkout. Note this may change in later events if the user removes VAT, or changes delivery or billing country during the checkout  
    add_shipping_info [as per ’begin_checkout’] [as per ’begin_checkout’]

    add_shipping_info fires:

    Digital only products: on checkout entry

    Print products: on completion of delivery address

    add_billing_info [as per ’begin_checkout’] [as per ’begin_checkout’]

    add_billing_info fires on submission of the checkout

    purchase transaction_id The unique order id  for the completed checkout. purchase fires on entry to the Thank you page 
      currency [as per ’begin_checkout’]   
      value [as per ’begin_checkout’]  
      shipping The shipping value  for the order item.   
      tax The tax value  for the order item - note this may have been updated by user actions in the checkout from the original value when the checkout was entered.  
      items [as per ’begin_checkout’]  

    Learn how to report on Purchases in Google Analytics

    Unsupported e-commerce events

    The following events are not supported or not relevant to the checkout.

    • refund
    • add_to_cart
    • add_to_wishlist
    • remove_from_cart
    • select_item
    • select_promotion
    • view_cart
    • view_item
    • view_item_list
    • view_promotion

    Metadata for logged in users

    It is possible to output metadata about the current user on the checkout pages when they are logged in.

    The Metadata Extraction Text Asset allows these to be added to the pages. This follows the same format as the text asset used for V1 of the Advance front end. Please note that both versions need to be populated.

    Data can be pushed into the dataLayer to be picked up by GTM.

    More information on the available metadata and how to add custom dimensions to Google Analytics.

    Google Analytics - tips

    The checkout is built using React and, unlike traditional websites, will not load a new page for every user interaction. Depending on the level of detail you require it may be necessary to fire GA page views on History change as well as page load to capture all interactions of the user journey.

    Add History Change triggers to your page view tag in GTM.

    Abacus recommends setting two triggers. One for the Auth / Middleware and one for the Checkout.

    GTM_trigger

    You can limit the scope of these triggers to the Auth and Checkout URLs.

    GTM_History_Trigger

    Example of History Change pages 

    In the Middleware the page will not reload when:

    • User moves from email to either create account or enter password
    • User presses edit on their email address
    • User goes to forgotten password
    • User activates forgotten password

    By using the History Change trigger this will capture these journeys in Google Analytics

    Web Activity

    Web Activity will show in the Party record and is available in BI reports.

    Unlike Google Analytics events - Web Activity requires a user to have been created in ADvance before the activity can be captured.

    The following web activities will fire in the checkout.

    Web activity
     Web ActivityFired  Notes
     Checkout started

    Checkout started fires on:

    For logged in users:

    • On entry to Order Type page (gift/individual)
    • On entry to checkout - if not previously fired on Order Type page

    For logged out users

    • On entry to checkout after user has logged in 

    For guest checkout

    • After user has entered their details
    • Checkout started will re-fire if a guest user changes their email (as this will create a new user in Advance).

    Note: Checkout started does not fire sign-in / create account.

     
     Checkout completed  Fires on Thank you page when purchase has been successful.  
     Checkout restricted

    If a user is restricted from buying a variant by a BI Query, for example, a low cost trial they have already taken, the Web Activity will fire:

    • Logged in user - on checkout entry
    • For a Guest checkout this fires after the user has entered their details and pressed continue
    • For gifts - the Checkout restricted will fire after the gift recipient details have been entered
     

     

    Supporting documents

    Click links below to download and view individual files.