GA4 and Google Tag Manager Integration
Complete guide to measuring the impact of audio listening on your conversion rate.
Objective
By the end of this guide you will have a complete measurement pipeline: Ekoo widget events are captured by your callback, pushed to the dataLayer, intercepted by GTM, then sent to GA4. You will be able to compare the conversion rate of visitors who listened to audio against those who did not.
Pipeline Overview
1Widget Ekoo → onEkooEvent() → dataLayer.push() → GTM Trigger → GA4 Event Tag → GA4 ReportsEach link in this chain is detailed below. Follow the steps in order for a seamless integration.
Step 1 — Configure the Widget to Send Events to the dataLayer
Place the Ekoo widget on your page, define a callback function, then load the script. The function pushes each event into the dataLayer with a GA4-compatible name (underscores, prefixed with ekoo_).
1<ekoo-widget2 data-ekoo="YOUR_WEBSITE_ID"3 data-ekoo-product-id="YOUR_PRODUCT_ID"4 data-ekoo-locale="fr"5 data-ekoo-on-event="onEkooEvent"6></ekoo-widget>78<script>9 function onEkooEvent(data) {10 window.dataLayer = window.dataLayer || [];1112 // Push all Ekoo events to dataLayer13 window.dataLayer.push({14 event: 'ekoo_' + data.stats.type.replace('-', '_'),15 ekoo_event_type: data.stats.type,16 ekoo_widget_type: data.stats.widget,17 ekoo_review_id: data.audioId,18 ekoo_product_id: data.productRef,19 ekoo_source: data.source20 });21 }22</script>2324<script src="https://app.ekoo.co/widgets/widget-4.0.0-standalone.js"</script>When a visitor starts playback, the ekoo_played_0 event is pushed to the dataLayer. This is the event that will allow you to segment your audiences in GA4 and measure the impact of audio listening on conversion.
Warning
The callback function must be defined before loading the Ekoo script. If it is declared after, the widget will not be able to call it and events will be lost.
Step 2 — Configure Google Tag Manager
2.1 Create Data Layer Variables
Data Layer Variables allow GTM to read the properties pushed by your callback. Create one variable for each property you want to use in your tags.
- In GTM, go to Variables > User-Defined Variables > New
- Choose the type Data Layer Variable
- In Data Layer Variable Name, enter:
ekoo_event_type - Name the variable
DLV - ekoo_event_typeand save - Repeat for each property:
| dataLayer Key | GTM Variable Name |
|---|---|
ekoo_event_type | DLV - ekoo_event_type |
ekoo_widget_type | DLV - ekoo_widget_type |
ekoo_review_id | DLV - ekoo_review_id |
ekoo_source | DLV - ekoo_source |
2.2 Create a Trigger for Ekoo Events
The trigger tells GTM when to fire your GA4 tag. You can create one trigger per event, or a single catch-all trigger using a regular expression.
Option A — One trigger per event:
- Go to Triggers > New
- Type: Custom Event
- Event name:
ekoo_played_0 - Name the trigger
Trigger - Ekoo Played 0 - Save
Option B — A single regex trigger (recommended):
- Go to Triggers > New
- Type: Custom Event
- Event name:
ekoo_.*and check Use regex matching - Name the trigger
Trigger - Ekoo All Events - Save
Tip
To keep things simple, you can create a single regex trigger ekoo_.* and a single GA4 tag that uses {{DLV - ekoo_event_type}} as the event name. This way, all Ekoo events are automatically forwarded to GA4.
2.3 Create a GA4 Event Tag
This tag sends Ekoo events to your GA4 property.
- Go to Tags > New
- Tag type: Google Analytics: GA4 Event
- Measurement ID: your
G-XXXXXXXXXX - Event name:
{{DLV - ekoo_event_type}}(dynamic mapping) or a fixed name such asekoo_audio_play - Add the event parameters:
| Parameter Name | Value |
|---|---|
ekoo_event_type | {{DLV - ekoo_event_type}} |
ekoo_widget_type | {{DLV - ekoo_widget_type}} |
ekoo_review_id | {{DLV - ekoo_review_id}} |
- Under Triggering, select the trigger created in the previous step
- Save the tag
2.4 Test in GTM Preview
Before publishing, validate the integration using GTM Preview mode:
- Click Preview in the top-right corner of GTM
- Enter your site URL and click Connect
- Navigate to a page containing the Ekoo widget
- Interact with the widget (start audio playback)
- In the GTM Debug panel, verify that your
ekoo_*events appear in the timeline - Click on the event, then on your GA4 tag to verify that the variables are correctly passed
Warning
Remember to enable Preview mode before testing. Without it, unpublished tags will not fire on your site.
Step 3 — Leverage Data in GA4
3.1 Verify Event Reception
- Realtime: go to GA4 > Reports > Realtime. The
ekoo_*events should appear within seconds after interacting with the widget. - Event list: go to GA4 > Configure > Events.
ekoo_played_0should appear within 24 to 48 hours.
3.2 Mark as Key Event (Conversion)
If audio listening is a key indicator for your business, mark the event as a conversion:
- Go to GA4 > Configure > Events
- Find
ekoo_played_0in the list - Enable the Mark as key event toggle on the right
The event will now appear in GA4 conversion reports and can be used as a goal in your advertising campaigns.
3.3 Create a Comparative Conversion Analysis
Goal: compare the conversion rate between visitors who listened to audio and those who did not, to demonstrate the business impact of audio.
- Go to GA4 > Explore > New Exploration
- Create Segment 1 — "With audio listening": include users who triggered the event
ekoo_played_0 - Create Segment 2 — "Without audio listening": exclude users who triggered the event
ekoo_played_0 - Under Dimensions, add: Event name
- Under Metrics, add: Conversions, User conversion rate
- Apply both segments to the report
- Compare the columns: the difference in conversion rate between the two segments reveals the impact of audio listening
Best practice
Use played-0 (audio start) as the segmentation criterion rather than played-100. A user who starts the audio already shows engagement intent, even if they don't listen to the end.
Recommended Event Mapping
| Ekoo Event | dataLayer Event | GA4 Event | Usage |
|---|---|---|---|
printed | ekoo_printed | ekoo_printed | Widget visibility |
played-0 | ekoo_played_0 | ekoo_played_0 | Audio start |
played-25 | ekoo_played_25 | ekoo_played_25 | Partial engagement |
played-50 | ekoo_played_50 | ekoo_played_50 | Medium engagement |
played-75 | ekoo_played_75 | ekoo_played_75 | Advanced engagement |
played-100 | ekoo_played_100 | ekoo_played_100 | Full listen |
Common Pitfalls
- Hyphens in GA4 event names — GA4 does not allow hyphens in event names. Always use
data.stats.type.replace('-', '_')to convert them. - Forgetting to initialize the dataLayer — if
window.dataLayerdoes not exist at the time of thepush(), the event is silently lost. - Callback defined after the script — the
onEkooEventfunction must be declared before loading thewidget-4.0.0-standalone.jsscript. - Mismatched function name — the value of
data-ekoo-on-eventmust exactly match the name of your global function (case-sensitive). - GTM Preview not enabled — unpublished tags do not fire without Preview mode. Always enable it before testing.
- Events missing in GA4 — data only appears in Configure > Events after 24 to 48 hours. Use Reports > Realtime to verify immediately.
Complete Recap Example
Below is the full code to place on your page for a working GA4 integration via GTM. Copy-paste this block and replace the uppercase values with your own.
1<!-- 1. Ekoo Widget -->2<ekoo-widget3 data-ekoo="YOUR_WEBSITE_ID"4 data-ekoo-product-id="YOUR_PRODUCT_ID"5 data-ekoo-locale="fr"6 data-ekoo-on-event="onEkooEvent"7></ekoo-widget>89<!-- 2. Callback — BEFORE the Ekoo script -->10<script>11 function onEkooEvent(data) {12 window.dataLayer = window.dataLayer || [];1314 // Push the event with a GA4-compatible name15 window.dataLayer.push({16 event: 'ekoo_' + data.stats.type.replace('-', '_'),17 ekoo_event_type: data.stats.type,18 ekoo_widget_type: data.stats.widget,19 ekoo_review_id: data.audioId,20 ekoo_product_id: data.productRef,21 ekoo_source: data.source22 });23 }24</script>2526<!-- 3. Ekoo Script -->27<script src="https://app.ekoo.co/widgets/widget-4.0.0-standalone.js"</script>Note
Ekoo events do not use any cookies. Measurement relies entirely on client-side events pushed to the dataLayer. Your consent policy applies normally via GTM.