You can track user interactions that happen
inside the Shotgun ticketing widget embedded on your website.
The widget sends events to the parent page using
window.postMessage. If you use our
latest widget integration (iFrame + widget.js), the script
automatically listens for these messages and
pushes them into your site’s dataLayer. From there, you
can trigger your GTM tags (GA4, Google Ads, TikTok, Meta, etc.) with no custom
code.
How to use it
-
Prerequisites
- Your organizer GTM is set up and published on your website..
-
You’re embedding the Shotgun widget on your site and have added
the
widget.jsscript.
-
Enable tracking in GTM
- Import Shotgun’s GTM Template (or use the one you already imported).
- In the template, unpause and configure the tags you want to fire.
- All necessary triggers for Shotgun widget events are already included—just map them to your platforms (e.g., GA4 event tag, Google Ads conversion tag).
-
Verify it works
- Open GTM Preview on your page where the widget is embedded and interact with the widget (view, add to cart, checkout, purchase).
- You should see the corresponding dataLayer events and your tags firing.
Optional (advanced): manual listener
If you can’t use
If you can’t use
widget.js, you can forward messages yourself:
<script>
window.dataLayer = window.dataLayer || [];
window.addEventListener('message', function (event) {
// (Recommended) only accept messages from trusted Shotgun origins
if (event.origin !== "https://shotgun.live") {
return;
}
// Handle messages with a payload and push it to dataLayer
if (event.data?.type === "datalayer" && event.data.payload) {
dataLayer.push(event.data.payload);
}
});
</script>
Troubleshooting
- Confirm marketing cookies are accepted on your site and that ad-blockers are off during testing.
-
Ensure the widget iFrame is not sandboxed in a way that
blocks
postMessage. - In GTM Preview, watch for incoming dataLayer events on the parent page while you interact with the widget.