Search through more than a hundred articles on every aspect of

Maciej Rzadkowski
Written by Maciej Rzadkowski

Remarketing and tracking tags with

In this article you will learn how to manage different remarketing systems directly from

The truth is that almost every tracking or remarketing system works the same way. Here is how:

  1. You have to implement a simple code snippet on every page that will establish a connection with the system (a bit like with

  2. Then you "mark" different clicks and page views with unique event tags.

  3. When you want to retarget your users, you choose segments by selecting pageviews or events they have or haven't performed.

For example:

  • Facebook event tracking snippet looks like this:

fbq('trackCustom', 'Purchase');
  • Google Analytics looks like this:

ga('send', 'event', 'Videos', 'play', 'Fall Campaign');

and in general:

ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);

The problem with this process is that those events are usually triggered by clicks and page views, while many other data points that could influence your retargeting or tracking efforts.

For example:

  • CRM data (calls, meetings, number of days in each pipeline stage)

  • Personal data (position in a company, estimated price for that person, number of followers on Twitter)

  • Corporate data (company industry, company headcount, location ...)

In this article, we will go through the process of using the data listed above in the process of remarketing.

Before you start

  1. Make sure that your pixels or basic tracking codes are working properly.

  2. Make sure that is correctly implemented on your website.

Implementing marketing tags with

All you have to do to elevate your tracking and remarketing strategy to a new level is trigger event tags using Automation. The system itself stores all the data you need and applies advanced process automation. So, how do you do that?

  1. Open an automation process that you want to connect with your external tracking systems, for example, an automation that shows forms to a user.

  2. The automation below finds the people who are not yet in the CRM pipeline.

  3. In this example, add a simple Facebook event tag to people who submit their info.

  4. Connect the "on submit" node of the form with the "Send code" action module.|

  5. Now, configure the code to include this script:

<img src="" 
fbq('trackCustom', 'crm_form_submission')

Check the "append to HTML" checkbox. What this does, essentially, is it loads a pixel to the end of your <body>pageelement, and when the pixel has finished loading, it activates the Facebooktrackingevent. You can put any other JStracking script in place of the "fbq..." part.

6. Now Facebook will catch an event called crm_form_submitted every time someone goes through this automation and fills out the form.

7. Go to Facebook campaign settings and create a new remarketing campaign aimed at people who haven't yet performed this event.

  1. Go to Audiences in Ads Manager.

  2. Click Create Audience and select Custom Audience.

  3. Click Website Traffic.

  4. Click Custom Combination under Website Traffic.

  5. Click Event under URL.

  6. Choose a standard event you've added using

  7. Enter the number of days you want people to remain in your audience after they perform the event

8. Give your audience a name then click Create Audience.

It will look more or less like this:

Now all that's left is to create a new marketing campaign aimed at this audience.

Other systems

You can use an identical process for retargeting users on Adwords, Twitter, Linkedin or any other medium as well as for tracking people on Mixpanel, Google Analytics or Heap Analytics.

All you have to change is the JS snippet in the code sample provided in point 3 at the beginning of this article.

For example, if you want to send data to analytics, the code will look something like this:

<img src="" 
onload="if ('ga' in window) {
  tracker = ga.getAll()[0];
  if (tracker)
    tracker.send('event', 'Video', 'play', 'fall');

Please remember that this will work only if you have one Google Analytics script implemented in a header of your website - if you have more, you'll have to fetch the appropriate one by name or index.

Integrating with GTM (via Data Layer)

In many cases, companies implement Facebook or Analytics tags using Google Tag Manager. It turns out that there is a possibility to send data from to GTM so that GTM tags can use it to target other tags. This is done via Data Layer).

All you have to do is create an automation that starts with page visit (targeted at all pages) and leads to a Send code action module which includes the following script:

<img src="" 
'first_name': '',
'last_name': '',
'any_other_attribute': ''})

Of course, in the value field for each element, you have to include "receiver.attribute_name" in double curly braces. As you can see, you can include any user attribute and pass it along to data layer.

To retrieve it and use it inside GTM, you have to create data layer variables.

After creating the variables, you will be able to use them inside GTM tags.

Things to remember:

  1. Depending on the user location and the internet connection, the data layer events sent by might only land in GTM several seconds after the actual page visit. So, if you want to trigger some events based on those attributes, make sure to trigger them a few seconds after the page loaded event instead of going with page visit.

  2. When creating the data layer variable, it's best to select default value equal nothing so that you don't have a mess in your variables.