Active Campaign Event Tracking with Google Tag Manager

Google Tag Manager makes setting up event tracking like button clicking, form clicking or link clicking extremely easy – unfortunately, there is no direct option to send this data to Active Campaign yet.

In this video, we’ll teach you how to send dynamic event tracking data to Active Campaign with the help of GTM and a Google App Script.


Download the script here: https://measureschool.com/actracking
Outbound link click tracking: https://www.youtube.com/watch?v=ABo-Sk1QzrQ
Pre Fill Form Fields with email: https://www.youtube.com/watch?v=z20G9NqphYY
Google Tag Manager: http://back.ly/AdQ8
Active Campaign: http://www.activecampaign.com/?_r=K93ZWF56


GTM Ressource Guide: https://measureschool.com/guide
Free GTM Beginner course: https://measureschool.com/emailcourse
Courses: https://measureschool.com/products

Looking to kick-start your data journey? Hire us: https://measureschool.com/services/

FACEBOOK: http://www.facebook.com/measureschool
TWITTER: http://www.twitter.com/measureschool
RECOMMENDED MEASURE BOOKS: https://kit.com/Measureschool/recommended-measure-books

GEAR WE USED TO PRODUCE THIS VIDEO: https://kit.com/Measureschool/measureschool-youtube-gear

– Event tracking like button click tracking, phone tracking or link tracking is quite hard to set up. Google Tag Manager makes our life easier but unfortunately there’s no direct connection you can use to send event tracking data to the email marketing automation tool Active Campaign until now. In this video, I’m gonna show you how you can send dynamic event tracking data to Active Campaign with the help of Google Tag Manager and a Google Apps Script.

All and more coming up right after this. Hi there and welcome to another video of measureschool.com where we teach you the data-driven way of digital marketing. My name is Julian and on this channel we do tutorials, how-to videos and take a look at the latest marketing tech just like this one. So if you haven’t yet, consider subscribing.

Now we have been using the great email marketing automation tool Active Campaign on measureschool.com for quite some time now. The capabilities of Active Campaign path with the inexpensive price is quite amazing and as you might know, we’re always looking for ways to make the data that we track with Google Tag Manager more useful and more actionable. We’re looking for a way on how we can send data to Active Campaign via Google Tag Manager.

Unfortunately, Active Campaign makes it hard to send any data with Google Tag Manager into the tool because there’s no really native JavaScript API available for it. We came up with a workaround that utilizes Google Apps Script to send dynamic event tracking data into Active Campaign and that’s what I wanna show you today. If you wanna download our script and the tag template head over to measureschool.com/actracking. And we got lots to cover so let’s dive in. Today our journey starts at this brand new Active Campaign account where we want to install event tracking.

How would this actually look like in the end? Let’s go over to Contacts. And here we would see our contacts that we have currently on our list. Now we wanna send event data into one of these contacts. For example here, we want on this profile to show up on the All Activities our event tracking. Now there is something called Site Tracking as well which is pretty easily installed.

This will only give the URL that the user visited and not interaction data that you can actually track with the help of Google Tag Manager. Before we can get started we need to do some configurations so let’s go over to our settings and look on the tracking here. And here we can install our site tracking. Now, this is as I mentioned just a code that you can plug into your Google Tag Manager account to find all the pages, some of them to our page view tag that we file for Google Analytics in order to do page view tracking. But we want to actually go with the more advanced event tracking option which lets us send in custom data to our account dynamically with the help of Google Tag Manager.

Activate this option and what we need right here is our event key and later our account ID. This is something that we need to copy in a second. Now down here you need to actually define your events in advance, so you can’t just send in any data into Active Campaign. You need to define your events in advance and there are always two fields available. The actual name of the event and then the event data.

For example, I could predefine events like clicked or watched or added to cart, and these would now all be available to be sent into Active Campaign with custom data attached to them. How can we send data into Active Campaign?

Well, with the event tracking API. Unfortunately, the recommended ways of doing this isåÊmainly through backend technology so, server side communication between your website server and the Active Campaign event tracking API such as languages like PHP or Ruby. Now Google Tag Manager is based completely on JavaScript and we don’t wanna expose any kind of API keys with the request that we send and that’s why I came up with a solution that actually utilizes a proxy via Google App Script.

Now, this is where the magic happens. We will send the request into our Apps Script. It will take the data, populate our API keys and then send that data onto the Active Campaign event tracking API. To make a copy of this proxy, you can head over to measureschool.com/aceventtracking then you simply need to make a copy of this script into your own Google Drive account. And you’re ready to use this Apps Script. Now we need to fill out two parameters here, one is the API key and then the Active Campaign ID.

How you can find them is described here but as I mentioned already, we have here our event key. This is the key that we need to put into our copy right here. And then we need to have our account ID which we have right here. Copy that over and replace that. That should do it. Let’s save this. And the last step we need to go through is actually publish it so let’s go to this publish button and deploy as a web app. And the only setting we need to change here is that it is accessible to everybody and we can deploy it as app.

Now, you will be granted to give this app permission to actually send data out and receive data. We’ll connect to external services, allow this and we get our web app URL. Now with this URL, we can send our request. So let’s open up a new tab here and I’m gonna enter our URL, and this only works if you have the right query string attached. What is this query string?

I have a little example here. It’s basically the question mark and then the key value path, the key email, the key event and the key event data. And after the equal sign you would put your values, so you need to define the email that this event should go to. You need to define the event which we have defined previously in our settings. And the event data and this can be dynamic that is attached to this event. Let’s present it here. We get a response that this was successful so we can go back to our account into the right contact that we sent this to.

And we see now a new activity has been tracked. A click event with the value that we sent over of test. This works as expected. Now, how can we make this useful in Google Tag Manager. Well, we can use this URL, let’s copy that, to fire an event. Now on my Google Tag Manager account, I have come up with a little example where I sent over an event for Outbound Link Clicks to Google Analytics. Let’s go into our preview in debug mode here, try these all out.

Here we have our website, our preview in debug mode opened and if we click with the command key pressed on an outbound link this will fire an event which carries the values of event category Outbound Link Click and the event action is the URL that was actually clicked. How can we simulate this with our Active Campaign tracking script? Let’s go back to Google Tag Manager and the click track has already defined.

We actually showed you how to accomplish the Outbound Link Click in another video that you can check out as well if you wanna replicate this. But now we want to build our AC tracking script and what we would need to do all these is actually three values. Again, the event key that we have already defined which is click, the click URL and the email address that we want to attach this to. Now, there are different methods of actually getting the email address from the user. One would be to actually get the email address once it comes from a newsletter for example that you sent out.

You could put that into the query string itself and put it into a cookie so it’s available to use later on. We actually show you how to do this in another video on pre-filling a form field where this method is also used. You could also capture the email address once so it fills out the form or the preferred way doing it with Google Tag Manager would be to send that information into the data layer.

This would obviously also only happen if the user is logged in. On our example here we have a plug in running that lets us, pre-fills our data layer for us so in this first message here we have the visitor email that is currently locked in. I’m locked in on this online store right now and therefore, thi

Julian Juenemann
About the author: Julian Juenemann

Julian started and grew venture-backed startups with his unique 'data first' approach to Online Marketing. He then founded MeasureSchool.com to help marketers, like him, the data-driven way of digital marketing.

Newest Most Voted
Inline Feedbacks
View all comments
1 year ago

Hi Team, thanks for the help with event tracking with AC.

In this video, your example assumes the customer is logged, and thus the email is readily available on the page.

However, I want to be able to send event tracking data back to AC once a customer has clicked on a link in our email (not everything we do is for logged in users). Can you help me out?

Elijah John Yarra
Elijah John Yarra
1 year ago

How do you save that data in a cookie? I’m currently running a Funnel built on Clickfunnels and I watched your video above. I have the same question with Peter. This is my funnel. Free eBook > When they submit their info it will be passed by the Native Integration of AC in Clickfunnels (NOT AC FORMS) > They will receive the eBook via Email. I also setup my Site Tracking Code in GTM making a Tag then paste the code in a Custom HTML then create Trigger (All Pages). I tried testing also to send links via AC Campaigns… Read more »

6 months ago

Hi Julian. thank you for this great article. I have a question related to UTM parameters. We work with a vendor who sends traffic to our site via his link. When you click on the link, you’ll be redirected to our landing page. At the end of the URL, there are UTM parameters for “subid” and “uid”. I have already created a tag for the postback with “campaignid={{subid}}&clickid={{uid}}” parameters. What we need to do to capture the values that are passed for those fields when a visitor reaches our site? Thank you!

Simon Lidster
Simon Lidster
6 months ago

Thanks for the great video.

I seem to be getting my script blocked by the browser (Chrome) and the tag fails to fire.

“Cross-Origin Read Blocking (CORB) blocked cross-origin response ”

I’ve checked and it’s definitely the script that’s getting blocked.

Is this method still working, or have I made an error?

24 days ago

Hello ! Thank you so muche for this video 🙂

I’m trying to send to send multiple data via eventdata, is it possible ? I would like to send order detail after a bought action,
so I try to send my dataLayer eventdata={{order}}

My datalayer “order” has many info (sku, price, quantity), all is well interpreted in the message of GTM but Active Campaign interprets the infos this way : [object Object]

Can you help me ?