Mix front-end integration using the Tag and Custom JavaScript
The AB Tasty Tag allows you to code your own recommendation banners and automatically send analytics events, without adding manual tracking code. By enriching your HTML with simple data attributes, AB Tasty Tag detects impressions and clicks, enriches the data, and pushes events to your analytics tool through the dataLayer.
Prerequisite :
Have AB Tasty tag. To verify that you have successfully installed it on your website, open your console and type :
recosThis command returns a Promise that resolves with a product list, confirming that the tag is If you see a valid object returned, the tag is running correctly and ready to capture events.. Else contact your CSM.
Enrich your recommendation banner HTML
Add the following data attributes to your HTML elements to make the AB Tasty Tag detects them automatically:
data-reco-id="[RECO_ID]"
Identifies the recommendation container
<div data-reco-id="abc123">
data-reco-name="[RECO-_AME]"
Name of the recommendation
<div data-reco-name='Add to cart">
data-reco-click="[ACTION_ID]"
Tracks user interactions (clicks)
<a data-reco-click="click_product">
data-item-id="[ITEM_ID]"
Identifies a specific product in the recommendation
<div data-item-id="SKU_123">
Set up your Tag Manager (e.g. Google Tag Manager)
The AB Tasty Tag automatically pushes events to the dataLayer.
Your Tag Manager then needs to pick up these events and forward them to your analytics platform (e.g., GA4).
How It Works
The AB Tasty Tag automatically performs the following actions:
Event detection
Detects when an element with
data-reco-id=[RECO_ID]appears in the viewport.Detects clicks on any element with
data-reco-click=[ACTION_ID].
Event enrichment Each captured event is enriched with contextual data:
reco_id: from the nearest parent withdata-reco-id.reco_name: from the nearest parent withdata-reco-name.item_id: from the nearest parent withdata-item-id.item_ids: from all children elements withdata-item-idunder the samedata-reco-idcontainer.
Push events The AB Tasty Tag pushes the enriched event to the
dataLayer(which can be picked up by GTM) oryour analytic tool(Piano or Matomo).Analytics trigger GTM triggers send the event to your analytics tool, such as Google Analytics 4, for performance tracking and reporting.
Learn more:
Tracking Volume and Cost
Each recommendation view or click generates a tracking event. This increases the total number of events processed by your analytics tools (e.g., GA4 and BigQuery).
While these events are lightweight, exporting them at scale (especially to BigQuery) can generate additional costs depending on your data volume.
Learn more: Impact of BigQuery exports and tracking volume
Last updated
Was this helpful?

