I am constantly offering my readers to subscribe to Analytics Mania weekly newsletter. There are two types of tools that I use: embedded forms (by Soundest) in each blog post and popups (by Privy). In the future, I plan to fully migrate to Soundest, but this blog post is not about that.

Some of you might find popups irritating and, in some cases, I hate them too, especially, when I land on a website and a popup jumps right in front of me.

Dude, I have just landed. I have no idea what your website is about. Could I please at least take a quick peek of your site you try to convert me?

I always try to practice what I preach, that’s why my email popup flow is a bit different:

  1. When a visitor lands on my blog, I wait a minute to show a badge which says “Subscribe to newsletter”. It is not very annoying and displays a subscribe form ONLY if a visitor clicks the badge.
  2. After another 60 seconds, I display a popup which suggests leaving an email address and get the Ultimate List of 120+ GTM Resources.

I don’t want to overwhelm my visitors, that’s why I ask for their email only after 2 minutes. Everything made sense to me until I received an email from one of my subscribers.


The Problem – Email Subscribers Might Be Irritated

One day, I received an email. It was a reply to one of the newsletters I’ve sent.

Email from my reader

At first, I thought What do you mean? Later, all dots were connected.

Regardless of who the visitor was (subscriber or not), he was still spammed with my popup. Well, the word spammed is a bit too strong here because after you close it, the popup remembers this preference for another 30 days, therefore you’re not constantly annoyed.

On the other hand, nowadays, everyone has two, three, or even more devices that are used to browse, read blogs etc. If you close the popup on a smartphone, it will still appear if you clicked a link in Analytics Mania’s newsletter on a tablet.

So what can I do about it?


The Solution

Some of you might say that I shouldn’t use popups at all. Well, that’s not an option for me. Popups work and they attract a significant number of new subscribers which let Analytics Mania grow (otherwise, no one would use them). So instead of getting rid of them, I need to adjust timing when they appear in order to reduce their annoying nature.

In other words, I have to stop showing email popup and badge for those who have already subscribed.

By the way, the implementation is fairly easy and … surprise surprise… it involves Google Tag Manager. Unexpected, right? I know 🙂 Who would have thought that I’ll write something about GTM in this blog.

So here’s the plan:

  • We need to identify visitors which land on my blog from Analytics Mania emails.
  • Those guys and gals will get a special cookie called amEmailSubscriber.
  • With this cookie, I’ll block email popup and Subscribe to newsletter badge.

Nov 1, 2017. Update: I’ve just sent a newsletter to my subscribers and forgot to change the UTM setting, thus some of them still see the popup 🙁 I have to be more careful next time.

Google Tag Manager Course - Learn More

Identifying The Current Email Subscribers

Every time someone clicks a link in Analytics Mania’s newsletter, they are redirected to analyticsmania.com/post/some-blog-post (or any other page). In addition to that, the link is decorated with 3 additional parameters, utm_medium, utm_source, utm_campaign.

Among email service providers, this using UTMs is really common. I could easily utilize them as a way to identify how that visitor was acquired.

On a regular basis, I send two types of emails:

  • Weekly newsletter. UTMs are:
    • utm_medium: email
    • utm_source: newsletter
    • utm_campaign: always different, depends on a content.
  • Welcome email which is sent after someone subscribes or wants to download one of my guides. UTMs are:
    • utm_medium: email
    • utm_source: automated_email
    • utm_campaign: welcomeletter

It will be pretty easy to identify email subscribers who clicked anything in a welcome email, there’s no other source of traffic with this set of parameters: email + automated_email + welcomeletter.

However, I might have some problems with the Weekly Newsletter. email as a medium and newsletter as a source is too generic and I need to think of something else. utm_campaign would be good but each week its value differs. My solution?

I’ll start using an arbitrary prefix in all my weekly newsletters as utm_campaign, analyticsmania_* . So instead of GTM Best Practices, utm_campaign will be analyticsmania_GTM Best Practices.

To sum up, all visitors who land on any page of my blog AND the URL contains either weekly newsletter’s or Welcome email’s UTMs will be considered as subscribers of my mailing list.


UTM Variables and Pageview Trigger

First thing we need to do is create 3 variables which will retrieve the values of UTM parameters:

utm campaign source and medium

Then we’ll use them in two pageview triggers, one for visitors from Analytics Mania’s weekly newsletter and the second one from Welcome Email.

The first trigger will be initiated when:

  • utm_medium equals to email
  • AND utm_source equals to automated_email
  • AND utm_campaign equals to welcomeletter.

Pageview Trigger - Visitor from Analytics Mania Welcome Email

The second one will be triggered when utm_medium and utm_source are the same as in Welcome Email but the campaign is different, it must always start with analyticsmania_.

All my previous newsletters did not have this prefix meaning that this entire solution will work only for those subscribers who will click any link in the newsletter sent after November 1st, 2017.

Pageview Trigger - Visitor from Analytics Mania Newsletter


Let’s Set the Cookie

In one of my previous blog post, I’ve explained how you can easily set cookies with Google Tag Manager. Let’s use that very same code example with a bit modified values:

Cookie’s name is amEmailSubscriber (“am” stands for “Analytics Mania”), its value is true and the cookie is valid for 3 months (meaning that if a subscriber will not click any link in my emails for 3 months, he/she will start seeing popups again).

Let’s create a Custom HTML tag which will set this cookie in visitor’s browser and we’ll do that ONLY when a visitor comes from Analytics Mania’s weekly newsletter or Welcome Email.

Set cookie - Visitor is email subscriber

Keep in mind that I’ve assigned both previously created triggers. If one of them activates, the Custom HTML tag will be dispatched.


Test The cookie

It’s a good practice to do a checkpoint and test what we’ve done so far. Let’s save all changes, enable Preview and Debug mode, and go to the website. We need to add 3 UTM parameters to the link and refresh the page. That way the Custom HTML tag should fire, e.g.:


If the tag did not fire (as in the screenshot below), make sure that all 3 UTM variables are created correctly. You can do that by navigating to the Variables tab of Preview and Debug console and checking whether all of them have some value, instead of undefined.

Custom HTML set cookie fired

After the tag is fired, we need to check cookie’s value. There are two main ways to do it – browser’s built-in feature (developer tools) or a plugin.

Personally, I am using Chrome extension called EditThisCookie (also available for Opera users). This really simple and intuitive extension enables me to quickly check which cookies are currently in use and what data do they contain.

If you haven’t, you can download it here. If you’re using a different browser, here are some similar plugins:

Anyway, let’s get back to EditThisCookie. Once you have installed this extension, a cookie icon will appear next to the Menu icon (in Chrome).

EditThisCookie icon

Go to the website you’re currently working on, click EditThisCookie icon and you’ll see an expanded list of all cookies that are currently in use on that website. Look for a cookie named amEmailVisitor (you can choose any other name which suits your website) and see whether its value is true.

edit this cookie - amEmailSubscriber

Now, let’s proceed to the next step.


Updating Popup’s Tag and Trigger

As I have mentioned in the beginning of this blog post, I use Privy for my popups. It’s installed by using a Custom HTML tag template and Timer Trigger with the following settings:

Basic Timer Settings

By default, this timer trigger will fire for all visitors regardless of where they came from and that’s where our cookie could come in handy. We could update it and set the trigger to fire ONLY when a visitor does not have an amEmailSubscriber cookie.

But before that can be done, we need to “teach” Google Tag Manager to read the cookie and turn it into a GTM variable. We’ll do that by choosing 1st Party Cookie as a Variable Type.

1st Party Cookie - Analytics Mania Email Subscriber

As for Timer Trigger, we need to add an additional rule which will dispatch events ONLY for those visitors who are not my subscribers.

Updated Timer Trigger

Voilà! Now, I hope, my returning readers will be less irritated. To sum up, here’s how everything works:

  • When a visitor clicks any link in Analytics Mania Weekly Email Newsletter (sent after November 1st 2017) or Welcome email, they’ll be redirected the desired page with 3 UTM parameters: utm_medium, utm_source, and utm_campaign.
  • After he/she lands, Google Tag Manager will fire a Custom HTML tag which sets the cookie amEmailSubscriber: true.
  • Next time (within 90 days) when this visitor comes back to my website, the timer trigger (which launches a Privy popup) will not dispatch because the amEmailSubscriber cookie will block it.

I believe I’ve tested the implementation thoroughly but if you notice any bug, please let me know in the comments.


Drawbacks of this solution

There are two possible disadvantages of this solution you should keep in mind:

  1. If someone shares a link to my blog post (e.g. on social media) and it contains all 3 UTM parameters, those visitors will also not see the popup (even though they haven’t actually subscribed to my newsletter). Nevertheless, I still have a lot of embedded forms which can convert them, so this does not sound like a big issue to me.
  2. It does not solve the multiple-devices-per-user issue.


Conclusion: Annoy Email Subscribers Less with Google Tag Manager

So there you have it, another idea how you can leverage cookies with Google Tag Manager. Although this blog post is not directly related to Digital Analytics, it’s still very useful for Digital Marketers who are concerned about the experience of their visitors/readers/client/etc.

In this blog post, I’ve shared my idea (which I’ve implemented yesterday myself on this website) how to annoy email subscribers less with Google Tag Manager by adjusting the timing of when a popup must appear on the screen.

Instead of just showing it to all visitors after 1 or 2 minutes, I’ve decided to segment all my visitors into email subscribers and non-subscribers. Those who have already subscribed to my email updates will not see email popup for 90 days after their last click in my newsletters or welcome email.

Every time a new click happens, the expiration date of the cookie is extended to 90 days.


Julius Fedorovicius

Head of Developer Operations at Omnisend. I am highly interested in Google Tag Manager, Google Analytics, Google Ads, Email marketing, Email Deliverability, Digital Marketing in general. You can follow me on Twitter or Linkedin.