poptin Event Listener
How to track poptin interactions & conversions with google tag manager
To seamlessly measure user interaction and conversions of Poptin pop-ups on your website.
Start by creating a new custom HTML tag type in Google Tag Manager, copy the event listener and paste it there, set it to fire on pageview or DOM ready.
Proceed to variables to create new dataLayer variables for [poptinID] returns the Poptin pop-up ID, and the [popupAction] variable (returns the Poptin event that occurred, these can be pop up visibility, pop up close and form submissions).
After the creation of these variables, proceed to create your trigger. You can either create a single custom event trigger [poptinPopUpEvent] for all Poptin Popup events or create specific triggers and use conditions to streamline when it should fire the tag with the help of the [popupAction] variables.
You can now connect your marketing pixels/ tags to this trigger and use the data to make better marketing decisions about your Poptin Pop-up conversion funnel.
<script> //when a user is shown a popup function poptinVisible(poptin_id){ window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'poptinPopUpEvent', 'popupAction': 'popup visible', 'poptinID': poptin_id }); }; //when a user submits a poptin popup form function onpoptinSubmit(poptin_id){ window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'poptinPopUpEvent', 'popupAction': 'popup form submitted', 'poptinID': poptin_id }); }; //when a user closes a poptin popup function onpoptinClose(poptin_id){ window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'poptinPopUpEvent', 'popupAction': 'popup closed', 'poptinID': poptin_id }); }; </script>