Act-On Hack #1: How to implement source tracking in Act-On

Like all online marketers, you want to know where your website visitors initially came from. The so-called referrer URL or source. Google Analytics uses this data to determine the medium, source, and channel. Examples are:

  • Search engines
  • Links from other websites
  • Social media
  • Online ads
  • Email marketing campaigns
  • Affiliate links
  • Links built into software

It is vital to know the source of your leads to determine which source delivers the best leads or most revenue. We call this referrer URL or source tracking, but this is currently not available in Act-On.

Till now! Below I will explain how to implement not only source tracking but also an improved version of UTM tracking in Act-On.

UTM tags are places at the end of a URL. By using hidden fields in an Act-On form the UTM data can be saved in Act-On. But the UTM tags are gone when visitors decide to browse your website before submitting the form. This is solved with this solution by storing the UTM tags in a cookie.

 

How does it work

The basis is a javascript solution from Terminus (you can read the details on https://github.com/). The original script was created for adding UTM and referrer information to lead forms. With some changes we got it working for Act-On.

Below a short explanation of how it works:

  • You make adjustments to your Act-On form(s).
  • You place a javascript on every page of your website.
  • With every new visitor, the javascript creates a cookie in the visitor's browser. The source (referrer) and other data is stored in this cookie.
  • When this visitor fills in an Act-On form, the values ​​stored in the cookie are passed on to the form and saved in Act-On.

Is this GDPR Proof?

When placing a cookie, the question naturally arises: Should we not request approval for placing this cookie? From our point of view, there is no need to request approval to place the cookie because the data in the cookie is only used when the user agrees to the processing of data by submitting the form.

How is the data stored in Act-On?

The data is saved in the form submission list and can be used for further processing. The following data fields are available:

  • The five standard UTM parameters being utm_source, utm_medium, utm_campaign, utm_term en utm_content (field names: USOURCE, MEDIUM, UCAMPAIGN, UCONTENT, UTERM)
  • Initial Referrer - The URL from which the user came at the first visit (field name: IREFERRER).
  • Last Referrer - The URL from which the user came at the most recent visit (field name: LREFERRER).
  • Initial Landing page - The URL of the page the user entered on the first visit (field name: ILANDPAGE).
  • Number of visits - Number of visits to the website before the form has been completed (field name: VISITS).

In this blog, we focus on getting the Initial Referrer and Last Referrer stored in Act-On. The method for the other fields is the same.

The Act-On form

Create a new form or use an existing one.

Add 2 new hidden fields to the form and name them IREFERRER and LREFERRER. Do not change the naming of the fields.


Place the form on an Act-On landing page or on an external webpage. Remember the URL.

The javascript

The next step is the javascript. Upload the script to your website and copy the URL location of the javascript (you can download the script at the bottom of this blog). Do not upload it to your Act-On library because then it will be tracked as a download similar to a PDF. 

To add the javascript to the website pages you use Google Tag Manager.

Create a new tag in Google Tag Manager and call it Source Tracking.

Select Custom HTML as the tag type and place the javascript code in the HTML box. Format is <script src=”[URL location of javascript]” async></script>


The javascript must start loading after the Act-On form loading has completed, otherwise, the data in the cookie cannot be placed in the Act-On form. For this you have to set the trigger:

  • Go to trigger configuration and select trigger type Timer.
  • Set interval to 1500 milliseconds.
  • Set limit to 1.
  • You can specify additional conditions when the script must be loaded. In this example, all page URLs must contain the text acton.


Save and publish the tag and you are ready to start testing.

Testing the script

Browse to the webpage with the Act-On form.

Submit the form and check the Form Submission List whether the fields for IREFERRER and LREFERRER are filled. The data should have the format of Http%3A// or the text direct. 


If the fields are empty check the debugging section in this blog.

Convert referrer to source

The data has the format of http%3A// and contains the full source URL. For convenience, you want to change these to search, paid, referral, email or social. You can do this by connecting a maintenance program to the list:

  • Create a new field in the Form Submission List. Name this field Source.
  • Create a segment and name it Social.
  • The condition of the segment is: IREFERRER contains and enter all social media domain names.
  • Click Save.
  • Create a maintenance program to this segment, whereby the Source field is automatically filled in with the value Social.
  • You repeat the above steps for the other sources.

The segment social

The maintenance program social

Advanced settings

Check terminusapp.com for some advanced settings for the javascript.

Debugging

If you don't see any values ​​in the Form Submission List under IREFERRER and LREFERRER, this could mean the javascript is not loaded or the javascript does not fill in the hidden fields.

Check if the javascript is loaded using Google Chrome

Open your chrome browser. Install and activate the extension EditThis Cookie.

Go to the webpage with the Act-On form.

Click on the EditThisCookie icon and open the _uc_last_referrer tab. If there is a value the script loaded correctly. 


If there is no value, check if the URL of the javascript is correct.

Check if the Act-On form is being filled using Chrome

If the javascript loaded correctly the problem might be the Act-On form or settings in Google tag manager.

Go to the webpage with the Act-On form. Click the right mouse button and select Inspect.


Go to the TAB elements and search in the source code for the string IREFERRER. Check if the field contains a value as in the below example. 


If you see no value this could mean the naming of the fields is incorrect or the script is loaded before the Act-On form.

What the Hack is coming next?

We have some nice Act-On Hacks coming: Event tracking, video tracking and much more. Subscribe below to get notified when a new hack is live!

Download the javascript

Click the below button to download the javascript (zipped). 

Download javascript

About Stan & Stacy

We create and implement inbound campaigns that are relevant to your (potential) customers.

Our strength lies in Buyer Personas, Content Marketing, and Marketing Automation. Stan & Stacy has extensive experience with multiple marketing automation platforms including Act-On.

Feel free to contact us