{"id":5552,"date":"2023-03-27T17:28:33","date_gmt":"2023-03-27T14:28:33","guid":{"rendered":"https:\/\/trackingchef.com\/?p=5552"},"modified":"2023-04-03T09:22:13","modified_gmt":"2023-04-03T06:22:13","slug":"integrating-poptin-with-ga4-and-google-tag-manager","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/google-analytics\/integrating-poptin-with-ga4-and-google-tag-manager\/","title":{"rendered":"Integrating Poptin with GA4 and Google Tag Manager"},"content":{"rendered":"\n

One of my favorite tools for lead capture is Poptin<\/a>. 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.<\/p>\n\n\n\n

Integrating Poptin using Google Tag Manager<\/h2>\n\n\n\n

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.<\/p>\n\n\n\n

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

    Tracking Poptin forms with GA4 using GTM<\/h2>\n\n\n\n

    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.<\/p>\n\n\n\n

    Tag: Poptin event listener<\/h3>\n\n\n\n

    To track the Poptin popup we will add a Custom HTML snippet that listens to any interaction with the popups.<\/p>\n\n\n\n

    Simply create a new tag of the type Custom HTML and paste in the script below.<\/p>\n\n\n\n

    <script>\nvar poptinDataLayer = function(event) {\r\n    dataLayer.push({\r\n        event: event.detail.event_name,\r\n        poptin_name: event.detail.poptin_name,\r\n        poptin_id: event.detail.poptin_id,\r\n        poptin_target: event.detail.poptin_target,\r\n        poptin_type: event.detail.poptin_type\r\n    })\r\n};\r\n\r\ndocument.addEventListener(\"poptinView\", poptinDataLayer, false);\r\ndocument.addEventListener(\"poptinClose\", poptinDataLayer, false);\r\ndocument.addEventListener(\"poptinSubmit\", poptinDataLayer, false);\n<\/script> <\/code><\/pre>\n\n\n\n

    Set this tag to trigger on “All Pages”.<\/p>\n\n\n

    \n
    \"image-3003337\"<\/figure><\/div>\n\n\n

    Poptin Variables<\/h3>\n\n\n\n

    Create new variable to be used in the GA4 event.<\/p>\n\n\n\n

      \n
    1. Create a new variable of the type Data Layer Variable<\/li>\n\n\n\n
    2. Set the Data Layer Variable name to poptin_name<\/code><\/li>\n\n\n\n
    3. Set the variable name to “poptin_name” and save it<\/li>\n<\/ol>\n\n\n
      \n
      \"image-1332433\"<\/figure><\/div>\n\n\n

      Repeat for the following variables:<\/p>\n\n\n\n

        \n
      1. poptin_id<\/li>\n\n\n\n
      2. poptin_target<\/li>\n\n\n\n
      3. poptin_type<\/li>\n<\/ol>\n\n\n\n

        Tag: Poptin GA4 event<\/h3>\n\n\n\n

        Next, we will create the GA4 event.<\/p>\n\n\n\n

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

          Poptin Trigger<\/h3>\n\n\n\n

          Finally, create a new trigger of the type Custom Event.<\/p>\n\n\n\n

          Set the Event Name to poptinView|poptinClose|poptinSubmit<\/code> and check the “Use regex matching” box.<\/p>\n\n\n

          \n
          \"image-5036828\"<\/figure><\/div>\n\n\n

          Add this trigger to the Poptin GA4 Tag and you’re all set.<\/p>\n\n\n\n

          Completing the setup in GA4<\/h2>\n\n\n\n

          After you’ve created the setup in GTM, you will need to make sure GA4 is able to collect the data sent.<\/p>\n\n\n\n

          Configuring Custom Dimensions<\/h3>\n\n\n\n

          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.<\/p>\n\n\n\n

          To create a new custom dimension, open the relevant GA4 account and navigate to the Admin tab.<\/p>\n\n\n\n

          In the middle column, click on Custom Definitions.<\/p>\n\n\n\n

          Under the Custom Dimensions tab, click Create Custom Dimensions.<\/p>\n\n\n\n

          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.<\/p>\n\n\n

          \n
          \"image-2432347\"<\/figure><\/div>\n\n\n

          Repeat for all the event parameters sent (poptin_id, poptin_target & poptin_type).<\/p>\n\n\n\n

          Setting up conversions<\/h3>\n\n\n\n

          Last, but definitely not least, is configuring Poptin submissions as conversions.<\/p>\n\n\n\n

          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.<\/p>\n\n\n\n

          Simple navigate to the Conversions page (also in the Admin tab.<\/p>\n\n\n\n

          Click on New Conversion Event and paste in poptinSubmit<\/code><\/p>\n\n\n

          \n
          \"image-9761653\"<\/figure><\/div>","protected":false},"excerpt":{"rendered":"

          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 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,39],"tags":[],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5552"}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=5552"}],"version-history":[{"count":3,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5552\/revisions"}],"predecessor-version":[{"id":5607,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/5552\/revisions\/5607"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=5552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=5552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=5552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}