đź“Ť Bolt Help / Products / Checkout / How to Configure Checkout Analytics Using Callbacks
How to Configure Checkout Analytics Using Callbacks
Learn how to map Google Analytics and Facebook Pixel to steps in your checkout.

Previously, you learned how to integrate with Bolt Checkout. Now let’s enhance that integration by configuring analytics. Bolt supports pixel tracking by sending Shopper-triggered events to a merchant’s Google and Facebook analytics platforms. You must be an admin user in your Merchant Account to update tracking IDs.

Google Analytics (GA4) Setup

Managed Checkout Merchants

Click to expand.

Checkout Everywhere Merchants

Click to expand.

GA4 Checkout Event Mappings

Below is a list of GA4 ecommerce events. Unlike in Universal Analytics, checkout steps do not have to be mapped to GA4 using Bolt callbacks.

Checkout Step GA4 Event Description
1 begin_checkout Checkout initiated
N/A add_to_cart Fires once for every item added to cart
2 add_shipping_info Shipping details completed
3 adds_shipping_info Shipping method selected
Note: the command name is “add_shipping_options” to differentiate it from Checkout Step 2
4 add_payment_info Payment details entered
5 purchase Purchase completed

Migrating to GA4 from Universal Analytics

You can retain both UA and GA4 tracking. To learn more about the difference in behavior and data between the two, see Google’s documentation.

Prerequisites

You have created both a UA and GA4 property and have linked them.

Setup

Add the following tag to the frontend of your site. Replace the <Measurement ID> with the GA4 measurement ID.

<!-- Global site tag (gtag.js) – Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<Measurement ID>"></script>

<script>
window.dataLayer = window.dataLayer \|\| [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '<Measurement ID>');
</script>

NOTE

If you’ve already entered your UA ID within Bolt, you do not need to update it to the GA4 ID.

Behavior

With dual tagging, you will see the following within both the GA4 and UA dashboards:

  • Checkout data (checkout_begin, add_shipping_info, add_shipping_options, add_payment_info, purchase)
  • Non-checkout data (page_visit, scroll, user_engagement, etc.)

Enhanced Ecommerce Tracking (Legacy)

The Enhanced Ecommerce setting uses the Google Analytics standardized checkout funnel measurement with the Universal Analytics tracking ID (format UA-00000000-0) to track events in checkout. Refer to the Google Analytics Enhanced Ecommerce Developer Guide when considering this section.

TIP

Both of the following enhancements can utilize Javascript Promises to populate order data, which is used to enrich basic engagement information sent to Google Analytics.

Checkout Step Mapping

Checkout Steps must be mapped to Google analytics using BoltCheckout.Configure Callbacks. At this point, BoltCheckout.Configure should already be added to all pages where a shopper can check out from your store. If not, see Part Three, How to Integrate with Bolt Checkout.

Checkout Step in Google Analytics Bolt Callback
1 onCheckoutStart
2 onShippingDetailsComplete
3 onShippingOptionsComplete
4 onPaymentSubmit
5 Success
N/A onEmailEnter

Step Example Callbacks

The following example callbacks are provided to demonstrate the data structure required for Google Analytics to ingest product information; you can also insert optional context using the option key seen in the _onPaymentSubmit _function.

TIP

Calls should be updated in your BoltCheckout.Configure script across all pages that use Bolt Checkout. See the Transaction schema in our API documentation (the Authorize a Card Response) for data available for the Success callback.

function onCheckoutStart() {
  dataLayer.push({
    'event': 'checkout',
    'ecommerce': {
      'checkout': {
        'actionField': {'step': 1},
        'products': [{
          'name': 'Minimalist Tee',
          'id': '12345',
          'price': '15.25',
          'brand': 'Minimalists Club',
          'category': 'Apparel',
          'variant': 'Gray',
          'quantity': 1
       }]
     }

function onShippingDetailsComplete() {
  dataLayer.push({
    'event': 'checkout',
    'ecommerce': {
      'checkout': {
        'actionField': {'step': 2},
        'products': [ ]
     }
   }

function onPaymentSubmit() {
dataLayer.push({
 'event': 'checkout',
 'ecommerce': {
   'checkout': {
     'actionField': {'step': 4, 'option': 'Visa'},
     'products': [ ]
  }
},

'eventCallback': function() {
   document.location = 'checkout.html';
}

Purchase Tracking

Purchases can be mapped to Google Analytics using BoltCheckout.Configure callbacks. We recommend adding purchase measurements only to Step 5, the Success callback.

Facebook / Meta Pixel Settings

Bolt uses Facebook’s standard events when possible, to pass actions in checkout to Facebook through the pixel.

  1. Retrieve your Facebook Pixel ID from your Facebook Business account.
  2. Log into to the Merchant Dashboard.
  3. Navigate to Checkout.
  4. Go to Analytics & Tracking, then scroll to Facebook Pixel.
  5. Enter the ID into the “Facebook Pixel ID” into the field provided.

Checkout Step Mapping

Standard Facebook Event Custom Facebook Event Associated Bolt Callback
InitiateCheckout N/A onCheckoutStart
N/A onEmailEnter onEmailEnter
N/A ShippingDetailsComplete onShippingDetailsComplete
N/A ShippingOptionsComplete onShippingOptionsComplete
AddPaymentInfo N/A onPaymentSubmit
Purchase N/A success
N/A CheckoutClose close

Event Properties

Events include the following properties:

Property Notes
currency
num_items This property is only included with the InitiateCheckout event.
value
content_ids
contents
content_type This property is only included with the Purchase event.

Next Steps

Your Bolt integration with your analytics platform of choice should be complete and ready for full testing.