Big Open Data Layer for Storefront Analytics
The Big Open Data Layer (shortened as BODL, pronounced ‘Bottle’) is a JavaScript object that simplifies sending data from BigCommerce-hosted storefronts to third-party analytics providers. It gives third-party scripts access to clean, consistent data. BODL makes store sites more efficient by consolidating data of interest and presenting it as a package. Each analytics script does not need to fetch the same data independently.
BODL is event-based. Scripts can capture accurate storefront data as it exists at the moment a shopper triggers any BODL-supported event.
This guide illustrates the basics of using BODL data in your integration. This article does the following:
- Describes the standard BODL schema after a shopper triggers a specified event so that you can see how BODL organizes event data for your integration to capture.
- Provides an example script that uses the standard BODL object so you can examine BODL properties in the browser console.
- Gives an example of adding a BODL script to a storefront page using the Scripts API.
Prerequisites
For scripts to successfully use BODL to access storefront data, the following must be true:
- Enable BODL on the subject storefront using the control panel or the GraphQL Admin API’s Enable data layer mutation
- The storefront must use a stencil theme
BODL event schemas
BODL exposes data when shoppers trigger storefront events. Currently, BODL supports the following storefront events:
- Load consent
- Update consent
- Keyword search
- View banner
- View product page
- View product category
- Add product to cart
- View cart
- Remove product from cart
- Start checkout
- Add shipping information
- Add payment information
- Purchase order
Load consent
If a merchant enables the consent banner, the following fields appear in the BODL object for the bodl_v1_loaded_consent event when a page loads:
Update consent
If a shopper changes the cookie consent settings, the following fields appear in the BODL object for the bodl_v1_update_consent event:
Keyword search
When the shopper enters search keywords and clicks Enter or presses the search button, the following fields appear in the BODL object for the bodl_v1_keyword_search event:
View banner
When a shopper views a storefront banner, the following fields appear in the BODL object for the bodl_v1_view_banner event:
View product category
When the shopper clicks a button to view the category page for a product, the following fields appear in the BODL object for the bodl_v1_product_category_viewed event:
View product page
When the shopper clicks a button to view a product page, the following fields appear in the BODL object for the bodl_v1_product_page_viewed event:
Add product to cart
When the shopper clicks a button to add a product to a cart, the following fields appear in the BODL object for the bodl_v1_cart_product_added event:
View cart
When the shopper clicks a button to view a cart, the following fields appear in the BODL object for the bodl_v1_cart_viewed event:
Remove product from cart
When the shopper clicks a button to remove a product from the cart, the following fields appear in the BODL object for the bodl_v1_cart_product_removed event:
Start checkout
When the shopper clicks on the button to initiate a checkout process, the following fields appear in the BODL object for the bodl_v1_begin_checkout event:
Add shipping information
Each time the shopper adds shipping information, the following fields appear in the BODL object for the bodl_v1_shipping_information_added event. This event can trigger multiple times for a single order.
Add payment information
Each time the shopper adds payment information, the following fields appear in the BODL object for the bodl_v1_payment_information_added event. This event can trigger multiple times for a single order.
Purchase order
When the shopper clicks a button to finalize a purchase, the following fields appear in the BODL object for the bodl_v1_order_purchased event:
line_item object schema
The line_item object has many common fields for browser events, including the following fields:
Example implementation
You can use the Scripts API or control panel Script Manager to add scripts to a BigCommerce-hosted storefront.
Merchants must enable BODL in the store control panel for your script to subscribe to BODL events. Once BODL is enabled, BigCommerce checks every storefront page for the BODL object once per page render.
Example script
To view BODL properties in the browser console, use the following example script:
Category of consent
If a merchant enables cookie tracking consent, the shopper must provide consent to the category of consent (consent_category) to which the script is set. For more on consent categories, see the Script Manager support article.
Scripts API example
The following is an example request that uses the Scripts API to associate the example script with pages on a storefront. Send a request to the Create a script endpoint. For more, see the Scripts API article.