How to Track Website Activity In ActiveCampaign With Zapier

ActiveCampaign is a robust and popular email marketing and CRM platform. It allows you to track a user’s behaviour within email campaigns and basic page view activity on your website. But when it comes to tracking how people engage with your content, you’ll need to hire a developer…until now!

We wanted to find a better solution that could be implemented without having to hire a developer and without any complex coding.

Here’s the scenario

You’re an online entrepreneur and you want contacts to watch a sleek new video about a new service you’re providing.

You spent hours making this video…so you want people to watch it!

You expect a lot of your contacts to click on the link and view the landing page on your site, but you want to personally follow up with the ones that watch 80% of your video, those are the people you’ll really want to focus on.

Using native ActiveCampaign tracking, you wouldn’t be able to do this. You’d only be able to see if they visited the page. So we’ll help you implement a solution that works like a charm.

This is a specific example, but if you want to track things like link clicks or page scroll depth, you can do that as well using this same process.

Ok, let’s dive in…

The Tools & Accounts You’ll Need

You may not need a developer, but you will need a few tools in your toolbox. So here are the requirements before we get started.

  • You’ll need an ActiveCampaign account…obviously
  • You’ll need Google Tag Manager (GTM) set up on your website.
  • You’ll need at least a Starter Zapier account. If you don’t have one yet, you can try it out for free.
  • In our example, we’ll also need a YouTube account to host our new video.

Setting Up Tracking In ActiveCampaign

ActiveCampaign provides a few levels of tracking, Website tracking and Event Tracking.

To update these settings, go to ‘Settings’ > ‘Tracking’ > Enable site tracking

Site tracking allows you to see which pages a user visits and allows you to have chat conversations with your users as an additional feature depending on your plan level.

You’ll then need to add your website to the ‘Whitelisted’ section and include all webpages assuming you want it across your entire website.

Now they’ll give you some tracking code to install on your website. It looks something like this:

<script type=”text/javascript”>

(function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(new Date).getTime();r=t.createElement(“script”);r.src=o;r.async=true;i=t.getElementsByTagName(“script”)[0];i.parentNode.insertBefore(r,i)})(window,document,”https://diffuser-cdn.app-us1.com/diffuser/diffuser.js”,”vgo”);

vgo(‘setAccount’, ‘[acct-id]’);

vgo(‘setTrackByDefault’, true);

vgo(‘process’);

</script>

Keep this code handy because you’ll need it later.

Now to Event Tracking.

Event tracking allows you to track critical behaviours or ‘Events’ that your contacts perform, like watching a video.

ActiveCampaign comes with native click tracking for emails, but tracking actions on your website traditionally requires you to know how to communicate with their API through PHP or another coding language, which is what we’re trying to avoid.

To turn on Event Tracking, scroll down to the bottom of the ‘Tracking’ settings page and enable event tracking.

Now, for our example, we’ll add the event that we want to track…’Watched New Video’

Once you’ve added the event you want to track in ActiveCampaign, you’re ready to move over to Google Tag Manager.

Adding Site Tracking Code to Your Website With Google Tag Manager

Now you’re ready to add the code that ActiveCampaign gave you to track visitor activity on your website.

Head over to Google Tag Manager and create an account if you don’t have one, or log into your existing account.

You’ll need to set up an account, which is essentially your website name, but the on-screen walkthrough is pretty straight forward.

Once you have an account set up, you’ll need to install some code onto your website. This injects the Google Tag Manager code onto your site so everything you create within Tag Manager will be managed through this single piece of code.

Here are some guides depending on your setup:

Installing Google Tag Manager on WordPress

Installing Google Tag Manager on Squarespace

Installing Google Tag Manager on Shopify

Now that you have the GTM code on your website, you can get your ActiveCampaign tracking code onto your website via GTM. You’ll need to create a ‘Tag’ and a ‘Trigger’ within GTM to fire on every page of your site.

In GTM, click on ‘Tags’ and add a new tag.

Name it something relevant and select ‘Custom HTML’ for your tag configuration and paste the ActiveCampaign tracking code into the HTML input section.

For your trigger, simply choose ‘All Pages’, which should be a standard option within your account, but you can easily create that if you don’t already have one by clicking on the ‘+’ icon and creating a trigger to fire on ‘All Page Views’.

Once you have Google Tag Manager set up on your site and your standard ActiveCampaign tracking code saved, you’ll need to create your Zapier account.

Create A Zapier Account

If you don’t already have one, you’ll need a Zapier Starter account or higher to access the Premium Zapier Webhook trigger we’ll be using.

Zapier is a super easy to use API integration tool that allows you to communicate and send data between different cloud-based solutions.

Things like ActiveCampaign, Mailchimp, GravityForms…hundreds of different apps.

Chances are, once you have an account, you’ll find all sorts of opportunities to use it as you’re running your business. I’m not a Zapier salesman and I don’t receive anything if you sign up for an account. I just think it’s a great platform.

Ok, that’s all we needed to do to get our basic account and ActiveCampaign site tracking set up. Now we can start configuring our super special tracking.

Creating Custom Event Tracking In ActiveCampaign With Google Tag Manager (GTM)

At a high level, we’re going to use Google Tag Manager to identify when a user has watched 80% of our new service video, fire a ‘Tag’ when they do and alert Zapier. Then, Zapier will tell ActiveCampaign about it and voila, we’re event tracking in ActiveCampaign without a developer!

Here are the high level steps:
1) Include a %SUBSCRIBERID% personalisation tag as a query string parameter value in your ActiveCampaign email.
2) Grab that Subscriber ID value using a GTM User-Defined variable.
3) Pass that value to Zapier using a Webhook when a specific ‘Event’ occurs.
4) Record that Event in ActiveCampaign for our contact using Zapier.

Add Subscriber ID Personalisation Tag in ActiveCampaign

In order for tracking to get back into ActiveCampaign, we need to be able to identify the contact somehow. The easiest way to do this is to use their email address, but using our contact’s email address can raise some privacy concerns that we’d like to avoid altogether. We’ll use their Subscriber ID instead, which generally wouldn’t be considered Personally Identifiable Information (PII).

In order to do this, simply add a query string parameter, like ‘sid’ along with the %SUBSCRIBERID% personalisation tag to the URLs that you’re sending out in your ActiveCampaign email.

Here’s an example for when you’re setting up your email in ActiveCampaign:

Now, whenever a contact clicks on that big call to action button in your email, their Subscriber ID will be included in the link via the query string parameter you added.

Configure Your Variables in GTM

The next thing we need to do is set up GTM to track built-in variables and pick up that Subscriber ID whenever a contact lands on our intended website page.

Within GTM, go to Variables and click ‘Configure’.

For this example, you’ll want to turn on all of your ‘Video’ built-in variables, but you can also turn on your ‘Click’ variables and others while you’re at it.

Once these are turned on, you’ll want to set up a User-Defined Variable to capture the Subscriber ID that we’ll need to send to Zapier later on.

Within GTM > Variables, you’ll want to add a new User-Defined Variable, name it SubscriberID or something similar, and pick a variable type of URL.

You’ll want to grab the ‘Component Type’ of ‘Query’…

…and define the ‘Query Key’ as ‘sid’ (or whatever you used as a querystring parameter in your ActiveCampaign URL).

This will grab the ‘sid’ parameter value from the URL that you sent in the email, which will allow you to eventually connect the Event with your desired contact back in ActiveCampaign.

Create Your Tags & Triggers within GTM and Zapier

Now that you have your variable set up, you’ll need to set up a Tag and a Trigger in GTM to fire when your desired video is watched by the contact (or whichever user behaviour you’re trying to track).

A Tag in GTM defines the data that you want to send whenever a specific action happens on your website. That specific action is referred to as a Trigger.

Within GTM, click on ‘Tags’ and create a new Tag.

Name it something relevant and select the tag type of ‘Custom Image’. The custom image tag allows you to send information to a custom URL whenever your tag is triggered.

In order to know which URL to send it to, go back to your Zapier account and create a ‘Zap’.

Choose the ‘Webhooks by Zapier’ trigger and select ‘Catch Hook’.

Copy the URL that Zapier generates and paste it into the Image URL field within your newly created GTM tag.

Now you’ll need to add some information to the end of the URL that you just pasted to pass through the contact’s Subscriber ID. Do this by adding ‘?sid=’ along with the User-Defined Variable you created earlier.

You can add your variable by clicking on the folder ‘+’ icon and selecting your variable.

Now simply copy that full URL that you created and open a new tab in your browser to send some test data to Zapier.

Paste the URL and update the SubscriberID variable to one from your ActiveCampaign account. You can find the Subscriber ID value by viewing a contact in your ActiveCampaign account and grabbing the number at the end of the URL (e.g. https://myaccount.activehosted.com/app/contacts/203).

Your website address field should look something like this: https://hooks.zapier.com/hooks/catch/764731/o203ksps/?sid=20935

Once you’ve added a sample Subscriber ID to your URL, hit enter. You should see a success message in your browser. This just sends along some test webhook data to Zapier to help us build the rest of our Zap.

Head back to Zapier and fetch some test data for your Zap. You should see data come back with the Subscriber ID you used in the querystring.

Great! You’ve got some test data, but before you finish setting up your Zap, you need to finish setting up your trigger in GTM.

So head back to GTM and choose a trigger that controls when the ‘Event’ should be recorded.

In this case we’re going to create a new Trigger, name it something relevant and select the ‘YouTube Video’ trigger.

We’ll set it up to trigger when our video ‘Progress’ reaches 80%. To do this, we only want this specific Tag to fire when the progress reaches 80% and the Video Title = “My New Service Video”, so we’ll only fire the trigger on ‘Some Videos’ and define the title as a triggering condition.

Note that you can trigger this on all videos and set up a custom parameter in GTM to capture the Video Title, which you can then pass to Zapier in your Image URL by using another query parameter (e.g. ?sid={{SubscriberID}}&video={{vid-title}}), but we’ll keep it simple in this example.

Save your Trigger and save your Tag. Then publish your container in GTM by submitting your changes.

You can check to see if your setup is working by ‘Previewing’ your workspace in GTM. This will activate a special GTM previewer when you visit your website in the same browser.

Once you’re happy your triggers and tags are firing correctly, you can head back to Zapier to finish setting up your Zap.

Sending The Event Data to ActiveCampaign From Zapier

So by now, you’re:
1) identifying a Subscriber ID by including it in your email’s call to action URL
2) capturing that Subscriber ID in GTM
3) passing that value to a Zapier webhook when the desired ‘Event’ occurs on your website

Now you need to record the Event in ActiveCampaign against your contacts so you can leverage it within your marketing efforts.

Head back to the Zap you’ve started creating and add a new ‘Webhook by Zapier’ action step.

In order to record an Event against a contact, ActiveCampaign requires their email address. In order to do that you’ll need to take advantage of ActiveCampaigns API to retrieve the contact’s email address.

In your Zapier Webhook action, choose the ‘GET’ Event and continue.

You’ll need to provide a URL to send that GET request to, so head back to your ActiveCampaign account and go to Settings > Developer to grab your API Access URL. It’ll be something like https://myaccount.api-us1.com.

In order to call the ActiveCampaign API to get your contact’s information, you’ll need to append ‘/api/3/contacts/’ as well as your Subscriber ID that was passed from GTM by selecting the ‘Querystring Sid’ variable Zapier captured in step 1 of your Zap.

Set the following in the additional settings, which may be the default settings anyhow:
– Send as JSON > No
– JSON Key > json
– Unflatten > Yes
– Basic Auth > (leave blank)

In the Headers section, you’ll need to define an ‘Api-Token’ and pass along your unique API Access Key to authenticate your webhook request. So head back to ActiveCampaign, go to Settings > Developer and copy your API Access Key.

Enter ‘Api-Token’ and your API Key in the Headers fields in your Zap.

Now you can send a test to ActiveCampaign to grab your contact’s information.

You should see a success message along with the contact information that’s stored in ActiveCampaign.

Within that successful webhook request, you can search for the ‘@’ symbol to see the email field and value that was returned. This is what you’ll use to record the Event for your contact.

Create a new ActiveCampaign action step in Zapier to create a tracked event.

You’ll need to connect your ActiveCampaign account using the same API URL and API Key we used in the previous step.

Next, you’ll need your Event Key and Event Account ID from ActiveCampaign. You can find those by going to Settings > Tracking. 

Within the Event Tracking section, you’ll see your Event Key. Copy it and paste it into the Event Key field.

To grab the Event Account ID, click on the ‘Event Tracking API’ link below your Event Key and copy the ‘actid’ value to paste into Zapier’s Event Account ID field.

You can now populate the remaining Zapier fields.

Select the Event you created in ActiveCampaign earlier and enter an Event Value. This can just be some text to explain what triggered the event (e.g. Watched 80% of New Service Video). It can be as detailed or as simple as you like.

Finally, you’ll populate the Contact’s Email Address by using the email address field we obtained from the previous Zapier webhook action step.

Test out your final step to confirm the information passes to ActiveCampaign successfully.

Woohoo! It worked!

You’re all set to turn your Zap on and send out your new marketing campaign knowing that you’ll have actionable tracking to follow up with the right customers at the right time!

Leave a Comment

Your email address will not be published. Required fields are marked *

FREE LOCAL SEO ANALYSIS

Identify the most valuable opportunities for your business to improve it's rankings

This free (and highly detailed) analysis will help you improve your Google rankings in your local area

No thanks, I don't want to improve my rankings

FREE GMB ANALYSIS

See how your business ranks in your local area

This free (and highly detailed) analysis will help you improve your Google Map rankings in your local area

No thanks, I don't want to improve my rankings
Free GMB Analysis