How to Configure Checkout Analytics Using Callbacks
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.
Add Tracking IDs
The following steps apply to both Google and Facebook IDs:
- Log in to the Merchant Dashboard.
- Navigate to Checkout > Analytics.
- Update the following:
- Google Analytics Tracking ID
- Facebook Pixel ID
- Select Edit.
- Insert ID.
- Select Update to save.
The ID populates in the row after updating. To edit, simply repeat these steps.
Google Analytics Settings
Enhanced Ecommerce Tracking
The Enhanced Ecommerce setting uses Google Analytics’ standardized checkout funnel measurement to track events in checkout. Refer to 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 Pixel Settings
Bolt uses Facebook’s standard events when possible, to pass actions in checkout to Facebook through the pixel.
Pixel Ecommerce Tracking
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. |
Summary
In this article, we’ve learned how to set up Google Analytics and Facebook Pixel tracking using callback events mapped to each step in checkout. At this point, your Bolt Integration should be complete and ready for full testing.