Integrating Poptin with GA4 and Google Tag Manager

One of my favorite tools for lead capture is Poptin. Besides being a great tool with fantastic functionality, it also features two great founders, Tomer and Gal, who I can personally say have influenced much of the work I do as a marketer.

Integrating Poptin using Google Tag Manager

To add Poptin to your site you need to add their JavaScript snippet on all pages. One way to do this is by using a Custom HTML tag. Another (better) approach is to use the Custom Template Tag created by the Poptin team. Generally speaking, when built correctly, these tags offer better performance and leave less room for human error compared to Custom HTML tags, so I highly recommend using them.

Using the Custom Template Tag

  1. Create a new tag in GTM
  2. When choosing the Tag Type, select “Discover more tag types in the Community Template Gallery”
  3. Search for Poptin (by poptins) and add it to your container
  4. Fill in your Poptin User ID in the relevant field
  5. Add a trigger (likely All Pages)
image-8837078

Tracking Poptin forms with GA4 using GTM

Now that you have Poptin set up on your site you will likely want to track interactions with it. To achieve this, we will need to create several tags, triggers and variables.

Tag: Poptin event listener

To track the Poptin popup we will add a Custom HTML snippet that listens to any interaction with the popups.

Simply create a new tag of the type Custom HTML and paste in the script below.

<script>
var poptinDataLayer = function(event) {
    dataLayer.push({
        event: event.detail.event_name,
        poptin_name: event.detail.poptin_name,
        poptin_id: event.detail.poptin_id,
        poptin_target: event.detail.poptin_target,
        poptin_type: event.detail.poptin_type
    })
};

document.addEventListener("poptinView", poptinDataLayer, false);
document.addEventListener("poptinClose", poptinDataLayer, false);
document.addEventListener("poptinSubmit", poptinDataLayer, false);
</script> 

Set this tag to trigger on “All Pages”.

image-3003337

Poptin Variables

Create new variable to be used in the GA4 event.

  1. Create a new variable of the type Data Layer Variable
  2. Set the Data Layer Variable name to poptin_name
  3. Set the variable name to “poptin_name” and save it
image-1332433

Repeat for the following variables:

  1. poptin_id
  2. poptin_target
  3. poptin_type

Tag: Poptin GA4 event

Next, we will create the GA4 event.

  1. Create a new tag of the type GA4 Event
  2. Set the Configuration Tag to the existing tag in the container
  3. Set the Event Name to {{Event}}
  4. Under Event Parameters, add new parameters:
    poptin_name
    poptin_id
    poptin_target
    poptin_type
  5. Pair each parameter with the matching variable (created in the previous step) by clicking the lego brick next to the value
image-2072123

Poptin Trigger

Finally, create a new trigger of the type Custom Event.

Set the Event Name to poptinView|poptinClose|poptinSubmit and check the “Use regex matching” box.

image-5036828

Add this trigger to the Poptin GA4 Tag and you’re all set.

Completing the setup in GA4

After you’ve created the setup in GTM, you will need to make sure GA4 is able to collect the data sent.

Configuring Custom Dimensions

In order for the Event Parameters you’ve added to the GA4 tag to be reported in GTM properly, you need to set up matching Custom Dimensions in GA4.

To create a new custom dimension, open the relevant GA4 account and navigate to the Admin tab.

In the middle column, click on Custom Definitions.

Under the Custom Dimensions tab, click Create Custom Dimensions.

Set the Dimension Name to a friendly name, e.g. Poptin Form Name, and set the event parameter to the equivalent event parameter from GTM, e.g. poptin_name.

image-2432347

Repeat for all the event parameters sent (poptin_id, poptin_target & poptin_type).

Setting up conversions

Last, but definitely not least, is configuring Poptin submissions as conversions.

While it’s optional to wait for events to come in and then set the conversion by toggling them on in the event stream, I like to take a proactive approach to set these up in advance.

Simple navigate to the Conversions page (also in the Admin tab.

Click on New Conversion Event and paste in poptinSubmit

image-9761653

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts