Using Piwik PRO Tag Manager cookie-based variables to serve custom content

Published: June 3, 2016 Updated: August 24, 2018 Author Category Tag Manager, Use cases

Use case scenario

Let’s say that you have a special offer you want to serve to specific users who came to your website via a certain campaign. With Piwik PRO Tag Manager you can configure this custom content to be displayed without editing the source code of the website at all.

Here’s what we’ll need to proceed with this configuration:

  • A script which will allow us to save a cookie which is based on url tracking parameters – a full use-case on this is shown in this post
  • The popup source code

Free Comparison of 6 Enterprise-Ready Tag Management Systems

Get to know the 40 key differences between Google Tag Manager, Tealium, Segment, Adobe Marketing Cloud, Ensighten & Piwik PRO:

Download FREE Ebook

After configuring this setup, we want to be able to show a popup window to all returning visitors which came to the cloud.piwik.pro website via an AdWords campaign named “AdWords_promo”. This is synonymous with a user visiting the tagged URL:

https://cloud.piwik.pro/?pk_campaign=AdWords_promo&pk_medium=cpc&pk_source=google

Our cookie-saving script will save those cookies with the following values:

  • pk_campaign = AdWords_promo
  • pk_medium = cpc
  • pk_source = google

Now, thanks to this configuration our specific popup will be shown to a user upon any subsequent pageview. Until he or she closes the popup, of course.

Piwik PRO Tag Manager Configuration – cookie-based variable

First of all, we have to configure a cookie-based Piwik PRO Tag Manager variable which we’ll be using in the trigger configuration. Let’s go to the Variables item in the left menu (for more information on this topic check the Variables User Guide):

Variables in main menu
Variables in main menu

The configuration of the custom variable is quite easy:

  1. Set the Variable name
  2. Choose Cookie from among the available templates.
  3. Insert a Cookie name – this must be the same as the cookie name configured within the cookie-tracking script which is available here.
Configuring cookie-based variable
Configuring cookie-based variable

Save the new variable and go to the Tag list page.

Piwik PRO Tag Manager Configuration – tag and trigger

Ok, we have just configured our variable, after having set up the tracking cookie earlier, and now we have to connect all the bits into one tag with a specific trigger.

Let’s start by clicking the + Add a tag button to create a new tag:

Piwik PRO Tag Manager - adding a tag
Piwik PRO Tag Manager - adding a tag

Set the Tag name and choose Asynchronous custom HTML tag.

Paste the popup source code, which you should have prepared beforehand – and which we mentioned in the first section – into the next field

Last but not least, is the Trigger configuration. It is here that we will use our cookie-based variable which we have configured in the previous section.

The whole configuration should look like this:

Configuring trigger with cookie-based variable
Configuring trigger with cookie-based variable

Save the new Trigger as well as the whole tag. Now we can Publish our new changes.

Testing out

Now comes the big moment – testing out the new configuration. First, check to see if any popup is displayed after visiting a website via a URL without any parameters, tracking or otherwise. Nothing – which is ok!

Now let’s load this URL:

https://cloud.piwik.pro/?pk_campaign=AdWords_promo&pk_medium=cpc&pk_source=google

Refresh and voilà:

popup

Note: this special promo code is created only to present this use case. To try out Piwik PRO Cloud and get a special offer please contact the Piwik PRO team.

Free Comparison of 6 Enterprise-Ready Tag Management Systems

Get to know the 40 key differences between Google Tag Manager, Tealium, Segment, Adobe Marketing Cloud, Ensighten & Piwik PRO:

Download FREE Ebook

Tagged under

Author:

Szymon Grzesiak, Marketing Tech Lead

Tech savvy Performance Marketing Specialist. LinkedIn Profile

See more posts of this author
Free Comparison of 5 Enterprise-Ready Tag Management Systems

Share