How to send progress bar events to Google Tag Manager, GA4 or your own tools
The bar pushes four events to your dataLayer and dispatches them as JavaScript events: tier reached, gift added, gift chooser shown, gift button clicked. On by default.
What the bar sends
Yaco Progress Bar tells your own analytics tools what happens on the bar. Each event goes out twice, with the same data:
- a push to
window.dataLayer, the queue Google Tag Manager reads; - a JavaScript event dispatched on
document, for any other tool or for your own script.
No cookie is set and nothing is sent to a server by Yaco: consent stays managed by your own setup. If your theme has no dataLayer, only the JavaScript event is dispatched.
The four events
| dataLayer event | JavaScript event | When it fires | Its own fields |
|---|---|---|---|
yaco_pb_goal_reached |
yaco:pb:goal_reached |
The cart just reached a tier | goalId, goalType, unit |
yaco_pb_gift_added |
yaco:pb:gift_added |
A free gift was added to the cart | goalId, variantId, quantity |
yaco_pb_gift_offer_shown |
yaco:pb:gift_offer_shown |
The gift chooser was shown to a shopper | goalId |
yaco_pb_select_gift_click |
yaco:pb:select_gift_click |
A shopper clicked the gift selection button | renderId, integrationId, and trigger set to restore when the click puts back a gift the shopper had removed |
Every event also carries cartTotal, the cart total in the cart’s currency, and currency, its currency code. goalId identifies the tier, goalType is its type, and unit is what its bar counts.
In the dataLayer, the fields sit next to the event name. On the JavaScript event, they are in event.detail.
Use the events in Google Tag Manager
- In Google Tag Manager, create a Custom Event trigger and enter the dataLayer name, for example
yaco_pb_goal_reached. - Create a Data Layer Variable for each field you want to keep, for example
cartTotal. - Attach the trigger to your tag, for example a GA4 event, and publish the container.
The events fire on your published store, not in the theme editor.
Switch the events off
The events are on by default. To stop them, open Settings, section Tracking, and untick Send events to my analytics tools. The same card lists the events under Emitted events.
These events feed your tools only. The figures of the app itself do not depend on this setting: see statistics.
Something missing? Write to support@yaco.studio, or try it first in the demo.