The P4 team is currently running some changes to the site. Please be aware that you might be redirected to some other sources on the world wide web or you will find the content you are looking for in another format. If you notice anything missing, please let us know in the p4-general Slack channel. Thank you!

You can easily integrate Google Analytics with OptiMonk to track referrals and events from your popups. See below the best practices and instruction guides for monitoring your campaign’s performances. 

Keep track of the original traffic sources

For campaigns and popups that aims to redirect users to another domain, it’s important that we store the original traffic sources (URL tracking parameter). To make sure that we are not breaking the user’s sessions,  we strongly recommend to not use tracking parameters on the links created in OptiMonk’s popup. 

In OptiMonk’s popup editor you should also enable the option “Keep URL parameters” whenever creating a new call to action. Follow the example below:

When enabling this feature, OptiMonk will store the original traffic source from the tracking parameter and append to the link of the destination domain URL. See example below:



You can also use the Realtime reports in Google Analytics to debug your settings:

Understanding OptiMonk’s Events

OptiMonk provides us with some pre-defined events for monitoring user interactions with the campaigns created.  The events are sent via dataLayer.push method and follow the structure below: 

Event StructureDataLayer.push
    ‘OptiMonk action’: ‘{{action}}’,
    ‘OptiMonk label’: ‘{{Campaign Name}}’,
    ‘OptiMonk category’: ‘OptiMonk’,
    ‘event’: ”OptiMonk ‘ + {{action}}’
Label{{Campaign Name}}

Note that the {{campaign name}} value is the same as defined in OptiMonk when you’re starting a new campaign. On the other hand, the {{action}} value will vary according to the user type of interaction. 

OptiMonk’s types of event action
shownwhen a campaign is shown to the user (impression)
filledwhen the user converts on the campaign objective (eg. clicks on the cta button)
nowhen the user rejects the campaign (clicks on the closing link)
close(x)when the user closes the popup 

Check below an example of a sequence of dataLayer.push events fired when a user is presented with a popup and then converts by clicking on the call to action

Set up events in Google Tag Manager

We are using Google Tag Manager to read the dataLayer events sent from OptiMonk to Google Analytics. The setup is very simple and it only requires one trigger, two variables and one event tag. Follow the instructions below to implement it on your container. 

  1. Setup the triggers
    1. In Google Tag Manager go to Triggers > New > select the Custom Event trigger type.
  1. Name your new variable as “Event contains OptiMonk”
  2. Enable the checkbox for regex matching and define the event name = OptiMonk.*

  3. Set up the variables
    1. In Google Tag Manager go to Variables > User-defined variables > New > select the Data Layer Variable type
    2. Name your variable as “DLV – optiMonk action”
    3. Define the Data Layer Variable Name = OptiMonk action
    4. Repeat the first step and create another variable with the name “DLV – optiMonk label” 
  1. Define the Data Layer Variable Name = OptiMonk label
  2. Set up the Universal Analytics event tag
    1. In Google Tag Manager go to Tags > New > Create a new Universal Analytics tag and select the Event track type:
    2. Name the event tag as “P4 – GPI – UA Event – OptiMonk” 
    3. Define the event structure as the following. Link the variables created in the action and label fields.
      1. Category = OptiMonk
      2. Action = {{DLV – optiMonk action}}
      3. Label = {{DLV – optiMonk label}}
    4. Connect the event tag with the Google Analytics Settings variable linked to the Global Property (it’s usually named as {{P4 GP UA ID}}
    5. Add the trigger you created in the previous step.
  1. Check the preview below:

  2. You can also duplicate the tag above and link it to your local analytics settings variable. This will help you to fire events to both the Global Property and your local account.
  3. Use the preview mode to debug your setup. The event tag you have just created should be firing on OptiMonks interactions. Check the examples below.
    1. Event fired when a pop-up is shown:
    2. Event fired when user closes the popup:
  4. You can also use Google Analytics Realtime > Events report to debug your setup:

  5. Resume of the setup in Google Tag Manager:

If you have any doubts or need any assistance with the setup above, please contact us 🙂 

Set up a goal in Google Analytics

We also recommend setting up Goals in your Google Analytics view for monitoring the performance of popup campaigns. Creating a goal for popups goals will help you to measure the conversion rates of your templates and also to run A/B tests. 

  1. Go to Google Analytics > Admin > View > Goals > New Goal
  2. Select Goal Setup as Custom
  3. Edit your Goal Description. Give a name and select the goal type as Event
  4. Input the event structure you want to match for your Goal. The example below can be used for goals that capture the conversions on the popup campaigns:

    Obs: Make sure you are leaving the Label field as blank. This will enable you to capture events from all your pop-up campaigns.
  5. Save your goal and use Google Analytics > Realtime > Conversions report to debug your setup:

This will help you to you will be able to monitor the performance of your campaigns within a special OptiMonk Dashboard for Google Analytics.