How to set up and use Google Tag Manager with GetEmails

To set up Google Tag Manager, you’ll first need to create a free account and connect it to an existing Google account.

1. Go to the Google Tag Manager site, and click Create Account.

2. Fill out the Account Setup information with your Account Name, Country, Container name — which is your website address — and your Target platform. Then, click Create.

3. After you’ve read the service agreement, click Yes.

4. Paste the code onto every page of your website. Paste the <head> code to the top of your pages and the <body> code after the body tag. If you have questions about adding the code to your page, click Quick Start Guide

How to add snippet script to GTM

To add your snippet script, set up your first Tag.

1. Log in to Google Tag Manager. Click New Tag.

2. Give the tag a title at the top, such as GetEmails Collection Script. Click the pencil image in the Tag Configuration section.

3. Click Custom HTML under Custom.

4. Paste your GetEmails script into the HTML box.

How to fire script after x seconds on a page using a timed trigger

1. To set your script to fire after a certain amount of time on a page, click in the Triggering box. This will determine which pages will fire the GetEmails script.

2. Click the plus sign in the top right to configure your triggers.

3. Click the Trigger Configuration box. Then, choose Timer.

4. Name the trigger at the top. To get more targeted leads from your homepage, set the trigger to fire after 5 seconds, which would mean 5000 for the Interval. You’d never fire the script more than once, so type 1 in the Limit. Then, under Enable this trigger when all of these conditions are true, choose Page Path, equals and type /homepage/. When you’re finished, click Save.

Note: You cannot trigger multiple URLs via a single trigger in Google Tag Manager. You will need to either add multiple triggers or use a regex.

How to set script to fire immediately on other pages

To have another page fire the script immediately, instead of waiting 5 seconds like in the last example, you’ll need to set a new trigger.

1. To set a new trigger for your product pages, click the plus sign in the Triggering section.

2. Click the plus sign again in the top right-hand corner. 

3. Click the Trigger Configuration box and then choose Page View.

4. Name the trigger at the top, and click Some Page Views. Choose Page Path, contains, and then type the path for your chosen products (ex. /products). From our experience, the best results come from the highest-margin products. Hit the plus sign next to the first product to add more lines of product pages you want to fire the script on. Click Save.

How to exclude traffic by referral source

1. To exclude traffic by referral source, start by creating a new trigger. Click the plus sign in Triggering.

2. Click the plus sign.

3. Name it “Exclude” and then the source name (ex. Exclude Taboola). Click in the Trigger Configuration box. Choose Custom Event as the trigger type.

4. Give the event a name (Taboola). Change it to Some Custom Events and then choose Referrer, does not contain and then the name of the source, which would be Taboola in this example. Then, click Save at the top.

5. Once the trigger is saved, click New Tag.

6. Name the tag “GetEmails, Exclude Taboola,” or whatever the source name is. Click in the Tag Configuration box, and choose Custom HTML.

7. Paste your GetEmails script in the HTML box. Click in the Triggering box.

8. Choose the Exclude Taboola trigger you created, and click Save.

How to set your script to fire after a specific number of page views

To fire a trigger after a certain number of page views, you’ll need to first create a new variable.

1. Click Variables and then New.

2. Click in the Variable Configuration box, and choose 1st Party Cookie.

3. Name the variable Cookie — Page Count at the top and the Cookie Name Page Count. Then, under Format Value, put Convert null to as zero and Convert undefined to as zero, and click Save.

4. You’ll then need to create a Custom HTML Tag to read the value in the variable, Cookie — Page Count. To do that, go through the Tag steps again: New Tag > Tag Configuration > Custom HTML. Paste the HTML code you created into the box.

Here’s an example of the code:

<script>

  (function(){

   var cc = {{Cookie – Page Count}}-0+1

   document.cookie=”Page Count=”+cc+”;path=/;”;

  }());

</script>

5. You’ll need to add a trigger for the Tag to fire, so click the Triggering box > plus sign > Trigger Configuration > Page View.

6. Name the Trigger. Choose Some Page Views. Choose greater than and then type in how many pages you want them to view before it fires. Click Save.