Lab Activity: Adding Data Tags
Lab Activity: Adding Data Tags
Lab Activity: Adding Data Tags
Data Tags provide detailed data on the way shoppers interact with your store’s products. However, data tags are not only limited to only product data collection. Data Tags can also track your store’s header and footer for promotions and can collect data on whether those promotions were viewed and/or clicked. BigCommerce’s Data Tags are powered by Segment and Platform.js, and will send your store’s product data through to Google Analytics.
Cornerstone versions 2.6.0+ will have Data Tags already included in the theme.
Objectives
Prerequisites
enhanced_ecommerce. If the enhanced ecommerce property is not present in the features array, add it. The features object should then look similar to the example belowYou are now ready to begin adding data tags into the HTML files across your Cornerstone theme.
Data tags must be manually added to a product in order to track shopper events and interactions with a product. Because data tags collect product data at a very granular level, there will be multiple locations you will have to add tags on a singular product in order to get a comprehensive look at the product’s data. For example, a merchant has requested that a product can be viewed by clicking any of the following:
So, in order to get a fully comprehensive look at shoppers’ interactions with a product, you will want to include a data tag on each of these fields. If a specific product possesses multiple data tags, the data tag that is closest to the product is the one that will track clicks, product impressions, or product views.
Data tags will be implemented in your store by using simple HTML. In order to begin tracking, you will add data tags as an attribute to the already existing HTML tags present in your theme.
See Pull Request #1377 to see how Data Tags were implemented in Cornerstone 2.6.0.
Data Tag Implementation Example
You can see a data tag implemented in the HTML form tag in the code sample below:
In the above snippet, the data tag is embedded in a <form> HTML tag in lines 1 and 2. The data tag is data-list-name and its value is Brand: {{brand.name}}.
Currently, BigCommerce supports 11 different data tags. Below is a table with a breakdown of each tag and its description.
Mandatory Data
The “tracked product” refers to the product on which you are inserting the data tag on.
Custom dimensions and metrics are also supported. To add them in the config.json settings array, add the name of the dimension/metric followed by the generic custom metric/dimension alias.
Example:
Note:
Next, add the custom metrics/dimensions to the desired theme template: