Installing ActiveCampaign Tracking Code

I’m trying to install an ActiveCampaign tracking code to all on my website. I’ve been told that the code needs to go within the body tags, near the bottom of the page. The tracking code is listed below. Can you please help me understand how to install?

<!-- ActiveCampaign Tracking Code START -->
<script>
	var trackcmp_email = '';
	var trackcmp = document.createElement("script");
	trackcmp.async = true;
	trackcmp.type = 'text/javascript';
	trackcmp.src = '//trackcmp.net/visit?actid=123456789&amp;e='+encodeURIComponent(trackcmp_email)+'&amp;r='+encodeURIComponent(document.referrer)+'&amp;u='+encodeURIComponent(window.location.href);
	var trackcmp_s = document.getElementsByTagName("script");
	if (trackcmp_s.length) {
		trackcmp_s[0].parentNode.appendChild(trackcmp);
	} else {
		var trackcmp_h = document.getElementsByTagName("head");
		trackcmp_h.length &amp;&amp; trackcmp_h[0].appendChild(trackcmp);
	}
</script>
<!-- ActiveCampaign Tracking Code END -->

https://goalsarecool.com/

Thanks!
Blake

If you want to add some java or jquery scripts in x-theme, go here:

Appearance / Customize / Custom / Edit Global Javascript

Paste your code.

Thanks! Do you know if it will place the tracking code within the body tags, near the bottom of the page though?

It will be right before </body> tag at the bottom of your page:

<script id="x-customizer-js">
  <!-- ActiveCampaign Tracking Code START -->
<script>
	var trackcmp_email = '';
	var trackcmp = document.createElement("script");
	trackcmp.async = true;
	trackcmp.type = 'text/javascript';
	trackcmp.src = '//trackcmp.net/visit?actid=123456789&amp;e='+encodeURIComponent(trackcmp_email)+'&amp;r='+encodeURIComponent(document.referrer)+'&amp;u='+encodeURIComponent(window.location.href);
	var trackcmp_s = document.getElementsByTagName("script");
	if (trackcmp_s.length) {
		trackcmp_s[0].parentNode.appendChild(trackcmp);
	} else {
		var trackcmp_h = document.getElementsByTagName("head");
		trackcmp_h.length &amp;&amp; trackcmp_h[0].appendChild(trackcmp);
	}
</script>
<!-- ActiveCampaign Tracking Code END -->    </script>

</body>
</html>

Thanks Georgich! I can see the code when I view page source. :slight_smile:

Now I’ve got to figure out why I’m not seeing site tracking activity for subscribers in ActiveCampaign. Since the tracking code was just installed on my site, I guess it only shows activity from this point forward.

Bummer.

Thank you for your help with this.

@Georgich thank you for helping out. :slight_smile:

@goalsarecool if the code is already reflected before the closing body tag, it would be best to get in touch with ActiveCampaign as this is something they might be able to look into better since the code is already present on your site.

@Georgich was able to answer my questions related to this.

I’m good to go now… thanks Jade!

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.