You can use Google Tag Manager to control where and when your optins load on your site. Follow our documentation to learn how to integrate OptinMonster with Google Tag Manager.
You can use Google Tag Manager to easily manage loading your optin on all pages of your site. For more complex management of OptinMonster through Google Tag Manager see our Advanced Usage examples.
Step 1. Create a Google Tag Manager Account (optional)
If you don’t already have a Google Tag Manager Account you wish to use, you’ll need to create one.
Login to Google Tag Manager, if you don’t have any Accounts you’ll be prompted immediately to create one. If you have existing accounts and want to create a new one you can do so from either the Accounts or Admin pages.
In this example we’re starting without any previous Accounts so we’ll create a new Account once logged into Google Tag Manager. It’s as simple as giving the Account a name.
Select the Continue button to proceed.
Step 2. Create a Container
Google Tag Manager will prompt you next to create a Container for your new Account. Enter the domain for your Container and select ‘Web’ as the place you want to use the Container.
Select the Create button to proceed.
Step 3. Install Google Tag Manager Code
Next you’ll need to add the Google Tag Manager code snippet provided to your site, just after the opening
Step 4. Create a Tag
From the Container > Tags screen, select New to create a new Tag.
Name your Tag and choose Custom HTML Tag from the available options.
You’ll need to grab the Embed Code for the optin you wish to manage through Google Tag Manager. From your OptinMonster Dashboard select the embed icon next to the optin you want to use.
On the Embed screen select the Sitewide Embed option to add a single embed code for all optins:
Alternatively you can add individual embeds for each optin you create using the Campaign Specific Embed option:
Once you’ve copied the embed code you wish to use, return to Google Tag Manager and paste the optin’s embed code into the HTML field.
Expand the Advanced Settings section and select the Tag firing option you wish to use. In this example we’ll fire the Tag once per page load.
Select the Continue button to proceed.
Step 5. Configure the Fire On Rules
You’ll need to specify the rules you want to fire the tag on.
IMPORTANT: If you’re using the Sitewide Embed you’ll want to configure the Tag to fire on all pages of your site and control where on your site the optin appears through the optin builder’s Display Rules options.
If you’re using Google Tag Manager to extend the functionality of the Display Rules options you’ll likely want to use the Campaign Specific Embed option and control where the Tag fires throughout your site in Google Tag Manager.
For this example we’ve selected All Pages.
Select the Create Tag button to proceed.
Step 6. Preview and Publish the Tag
Once you’ve created your Tag you can either Preview or Publish it. From the Container > Tags screen you can select either option from the Publish button’s dropdown menu.
When you Preview the Tag, Google Tag Manager will show you specific data related to the Tag when you view your site from the same browser. Here we’re Previewing a Fullscreen optin we’ve added to the site using Google Tag Manager.
Once you’re done previewing, you’re ready to Publish your tag and you’ve successfully integrated OptinMonster with Google Tag Manager!
Load Optin on Specific Pages
Instead of loading your optin site-wide, you can control which pages it appears on using Google Tag Manager.
Step 1. Edit Your Tag
In Google Tag Manager navigate to Container > Tags and select the Tag you want to edit.
Step 2. Tag Firing Options
If you created your Tag following our Basic Usage steps your Tag will already be set to fire once per page in the Advanced Settings of your Tag Configuration options. You only need to fire the Tag once on page load when targeting specific pages.
Step 3. Fire On Settings
Next, select the Fire On section. If you setup your Tag following our Basic Usage steps you’ll want to remove the All Pages trigger first.
Select the Some Pages trigger from the available options.
Select the New button to add a new trigger.
Give your trigger a name and configure it as desired to target the page you want to load your optin on. In this example I’m loading the optin only if the page URL ends with
/blog/ to target my site’s blog page.
You can add as many triggers as you want for the same Tag.
When you’ve finished creating triggers, select the Save button to apply them to your Tag.
Step 4. Save Tag
Finally, save the changes to your Tag.
You are now ready to Preview or Publish your tag.