Optin Monster Event Listener

Seamlessly measure your Optinmonster pop-ups’ performance, the number of impressions they get, conversions, interactions, and even errors users experience while converting. With this Optinmonster event listener and Google Tag Manager, you’ll be able to enhance your marketing data.

How to track Optin Monster Pop Up Interactions with google tag manager

Measuring your Optinmonster pop-ups funnel and its performance in analytics tools such as Google Analytics (Universal & GA4), Mixpanel, PiwikPro, Fullstory, etc. Is easy and possible using Google Tag Manager.

And if you’re using advertising platforms like Google Ads, Facebook Ads, Microsoft Ads, Pinterest, etc. You can also measure conversions of these pop-ups using this Optinmonster event listener and Google Tag Manager.

To start the implementation in GTM, create a custom HTML tag that you’ll be adding this event listener script to, give the tag a name and trigger it on pageview or DOM ready.

This script will listen for Optinmonster pop-ups activity (impression, conversion, closing a pop-up and errors) and push the event and its attributes to the dataLayer.

The next step is to setup dataLayer variables, which gives you more insights about the event, these includes;
[campaignID] –> gives the ID of the Optinmonster pop-up campaign
[campaignName] –> this is the campaign name
[campaignDetail] –> returns campaign type, popup type.

There are 4 Optinmonster events triggered by this listener
[optinmonsterimpression] –> triggers when a pop-up is displayed
[optinmonsterconversion] –> for when a user converts
[optinmonsterCampaignClose] –> when a pop-up is closed
[optinmonsterError] –> when an error is experienced while converting

To trigger your marketing pixels/tags when these events happen, create a custom event for each of these events connect your GTM tag to the appropriate trigger.

<script>
/* https://optinmonster.com/docs/optinmonster-javascript-events-api/ */
// optinmonster conversion error
document.addEventListener('om.Optin.error', function(event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'optinmonsterError',
'campaignID': event.detail.Campaign.id,
'campaignName': event.detail.Campaign.name,
'campaignDetail': event.detail.Campaign.type
});
});
//tracking impression and conversion
document.addEventListener('om.Analytics.track', function(event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': "optinmonster" + event.detail.Analytics.type,
'campaignID': event.detail.Campaign.id,
'campaignName': event.detail.Campaign.name,
'campaignDetail': event.detail.Campaign.type
});
});
// user closes a campaign
document.addEventListener('om.Campaign.close', function(event) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'optinmonsterCampaignClose',
'campaignID': event.detail.Campaign.id,
'campaignName': event.detail.Campaign.name,
'campaignDetail': event.detail.Campaign.type
});
});
</script>

Video of how to use the listener

Related Event Listener

poptin pop up event listener

Poptin

Capture user interactions with your Poptin pop-ups and use the data to trigger your desired marketing pixels/tags in Google Tag Manager.

Pure Chat

Do you want to measure how users interact with your pure chat widget? use this event listener to easily measure these interactions in GTM.

Convert Kit Form

Easily measure Convert Kit form submissions conversions, using this event listener to trigger your marketing pixels and tags in GTM.

download the google tag manager recipe for tracking Optin Monster Pop Up Interactions

we make you smarter with data

made with ❤️

The DumbData Team
Before you leave, try out these free tools.
FREE GA4 AUDIT TOOL & UTM AUDIT TOOL