Datos Blog

Learn about business automation and operations

How to integrate Clickfunnels emails and site tracking with ActiveCampaign (the optimal way)

There are a few ways to integrate ActiveCampaign with Clickfunnels, each with their drawbacks. I’ll cover all three and let you decide what you want to use! You can click the links to skip to the method you want to use.

1. Use the built-in integration with Clickfunnels and ActiveCampaign.

Drawbacks: it doesn’t trigger ActiveCampaign site tracking, it only allows for one integration per page, and it doesn’t let you send all the information you want to AC. Below is the list of fields they’ll send.

2. Integrate forms manually using raw HTML code.

This is a lesser-known technique that I’ll show you below. It does allow you to send more information to AC, and it activates site tracking! However, it still has drawbacks: you can still only integrate one program at a time, and you can’t send UTM parameters back to AC. (For whatever reason, it breaks this tracking).

3. Use Zapier to send subscribers to ActiveCampaign. (My favorite!)

This gives you the most flexibility with what you can do, by far. It also has the advantage that you can integrate all your funnels at once without editing them manually. Using Zapier allows you to integrate an infinite amount of systems with Clickfunnels, too. The drawback is that Zapier can get expensive if you have a large volume of subscribers.

If you want the best, easiest, and most scalable integration option, choose this one.

How site tracking works in ActiveCampaign

In order for AC to know where a subscriber has been, they place a cookie on your site visitors. It only works if they can match an email address to that cookie. Clicking on a link in an AC email will match the email to the cookie, but filling out an AC form will also do this.

Unfortunately, the Clickfunnels integration does not tell ActiveCampaign the email address to match to the cookie, so we’re left with one sad cookie.

Thankfully, ActiveCampaign has told us how we can notify the cookie of the email address with javascript. I found a secret way to do this in Clickfunnels that I’m convinced no one has figured out before.

Method 1. Built-in integration

If you want to save money and don’t need to pass custom information to ActiveCampaign beyond what’s listed here, this is a fairly straightforward process.

I won’t cover what Clickfunnels already covers on how to set up the basic email integration, since their tutorial is pretty easy to follow.

Once you’ve set up this integration, this is how you set up site tracking with a custom script.

Step 1. Go to your ActiveCampaign account, click Settings, and click Tracking. Toggle tracking on if it’s not already, and add the website domain name you’ll be tracking to the whitelist.

Step 2. Copy the tracking code.

Step 3. Edit the code. Here’s where the magic happens. Clickfunnels keeps the email address in local storage once it knows the user (ie. when they submit the form). You’re going to modify the script to grab the email address and tell it to AC.

Below the opening <script> line and above the first line of code (function), add this line.

var useremail = localStorage.getItem("garlic:"+window.location.host+"*>input.email");

This creates a variable and sets it to the value of the email. The email is stored in a key called garlic:(yourdomain.com)*>input.email.

Add these lines right above vgo(‘process’);

vgo('setEmail', useremail);
console.log("User email %s sent to AC site tracking", useremail);

You can delete the console.log line if you want, but I find it helpful for troubleshooting. (You can check the console by right-clicking in your browser and clicking Inspect Element then opening the Console tab).

Your completed script should look like this:


<script type="text/javascript">
  
var useremail = localStorage.getItem("garlic:"+window.location.host+"*>input.email");

    (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', [YOUR ACCOUNT ID IN QUOTES]);
    vgo('setTrackByDefault', true);
    vgo('setEmail', useremail);   
    console.log("User email %s sent to AC site tracking", useremail);
    vgo('process');
</script>

Note: you can’t copy the above because it’s missing your account ID.

Step 4. Add it to either the funnel settings or Google Tag Manager. If you’re not using Google Tag Manager, you need to start now. Let’s say you build 10 funnels. Then you need to add a new script (like this one) to all of them. You can either go through and edit 10 funnels, or you can edit one place in Google Tag Manager and call it good (assuming you’ve already installed GTM on these funnels).

Basically, you do the work once so you can avoid it in the future.

In case you want to only apply certain scripts to certain pages or funnels, you can do that easily by editing GTM triggers.

To add it to the funnel settings, go here and paste it in the body tracking code box.

Don’t forget to scroll all the way down and hit the green save and update settings button.

If you are already using GTM, just add it as custom HTML and trigger on all pages. If you want to use GTM (please), read this tutorial on how to get started.

Step 5. Test the script! Open up an incognito window and submit a form on your funnel. Open inspect element and check the console to see if it got the right email and says it sent it to AC. Check ActiveCampaign for your contact. It should show the confirmation page under site tracking (it can’t track the sign-up page unfortunately).

Is this going over your head? If so, you may want to click the button below and get in touch with me.

Method 2. HTML form integration

This method will implement site tracking correctly without having to edit the tracking script, but it can be time-consuming because you need to create a form in AC for each form in Clickfunnels. It also keeps you from being able to track UTM parameters unless you use a workaround I’ll give you.

Rather than duplicating content, here’s another article that I wrote which covers this method.

If you want to track UTM parameters while using this method, you’re going to have some extra work to do.

Step 1. Set up the UTM parameter tracking script in Google Tag Manager. The trigger should be all pages.

<script>

function getCookie(cname) {
  var name = cname + "=";
  var decodedCookie = decodeURIComponent(document.cookie);
  var ca = decodedCookie.split(';');
  for(var i = 0; i <ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') {
      c = c.substring(1);
    }
    if (c.indexOf(name) == 0) {
      return c.substring(name.length, c.length);
    }
  }
  return "";
}
  
var utm_source = getCookie("utm_source");
var utm_medium = getCookie("utm_medium");
var utm_content = getCookie("utm_content");
var utm_campaign = getCookie("utm_campaign");

document.querySelectorAll("[data-custom-type='utm_source']")[0].value = utm_source;
document.querySelectorAll("[data-custom-type='utm_medium']")[0].value = utm_medium;
document.querySelectorAll("[data-custom-type='utm_content']")[0].value = utm_content;
document.querySelectorAll("[data-custom-type='utm_campaign']")[0].value = utm_campaign;
</script>

Step 2. In your Clickfunnels form, add four inputs. Change their type to custom type. Each one should be named after one of the utm parameters.

Example:

So you should have four inputs called utm_source, utm_medium, utm_content, and utm_campaign. (If you use utm_term, you can add that fairly easily to the script and add a fourth input).

Step 3. Hide the inputs.

Click this button to hide them:

You can always edit them later by finding them under this list:

Step 4. Add these same fields into your ActiveCampaign form, then repeat the process from the other post to integrate the form with Clickfunnels. You need to tell Clickfunnels to match each UTM input with the corresponding field in ActiveCampaign.

Hint: if you don’t already have UTM parameters as fields in ActiveCampaign, you’ll need to create those custom fields first.

Step 5. Test! Save the page and copy the page link. Add UTM parameters to the end of the link for testing purposes (ie. ?utm_source=test&utm_medium=testmedium&utm_content=testcontent&utm_campaign=testcampaign). Then go into incognito and visit the page with the UTM parameters included.

Fill out the form and sign up, and see if those URL parameters show up under your new contact.

Method 3. Use Zapier to integrate

I’ve already covered this method in an earlier post, but that post claims you need to manually integrate the forms if you want site tracking to work. That’s no longer the case due to the script I developed.

Click here to read how to integrate ActiveCampaign with Clickfunnels via Zapier, then read method #1 in this post to see how to make site tracking work.

Want to know how to integrate purchase information with ActiveCampaign? That post also covers it near the bottom.

Want help setting up your integration? Click the button below and let’s chat.

Skip forward

Never miss a post from Datos