To run a test and track visitors on your website, the Freshmarketer snippet needs to be added on your site. Adding the Freshmarketer CDN JS is a one time process.


Go to your Dashboard. Click on the Tracking code button at the top right corner.



The page opens with the Freshmarketer JS code snippet.



Copy the Freshmarketer snippet and add it to your website’s <head> tag.


Freshmarketer provides two options each of which has a basic functional difference in the code execution.


Synchronous code: The scripts are loaded and executed sequentially.


Asynchronous code: The scripts are loaded and executed concurrently. Since the scripts are executed simultaneously, there is a possibility of page flickering from the original page to the variation page. Hence, avoid using an asynchronous code for A/B testing and split testing  Learn more.


Click the Copy Code button to copy the JS code snippet. Instead, you can choose to send the code to an email id by clicking 'Send this to a Developer'.


If the code snippet is placed in the Footer tag, the code still works. But the original page appears first and then immediately changes to the variation page(if any), as the Freshmarketer code kicks-in. 


To avoid such potential problems, we recommend you to add the Freshmarketer JS snippet in the early execution path.


Once the code is integrated into your webpage, it does not require modifications every time to run various experiments. Multiple tests can be performed with the same code snippet installed on the webpage, from the same Freshmarketer account.


Verify your code installation:


Freshmarketer allows you to check the integration of the code snippet by providing the URL of the code-integrated page(s).


In the Tracking Code page, enter the URL of your web page in the Verify URL section.


Click on Verify button to check if your integration is successful.



Page Tracking:



Once the snippet is integrated, as soon as a visitor lands on your webpage, Freshmarketer will track the visitor with the help of browser cookies. The visitor data will be tracked anonymously. 


But when a visitor is converted as a contact in Freshmarketer and if you'd like to track the activities done by the contact on your website as a visitor, the page tracking feature has to be enabled. The list of domains that you need to track has to be specified here. We haven’t set any limitations on the number of domains that can be tracked, provided the Freshmarketer snippet is integrated on the domains.


For example, whenever a visitor submits a form that’s being tracked by a Web form tracking experiment in Freshmarketer, the tool will identify the contact and associate all the activities performed by the contact previously as a visitor on the website. Using this data you can perform contact activities inside Journeys, Segments, and activity profile, etc.