Mouseflow gives you complete control over what visitors get recorded. Your visitors coming from Google Ads links will automatically be tagged with their "gclid" (Google Click ID) in our app.

However, you may want to record only traffic coming from clicks on your Google Ads. In this case, you can also control which visitors get recorded.

Setup

To only track visits from Google Ads, we can check for the "gclid" for all visitors who come to your page). We can use JavaScript and browser cookies to only record users who enter your website with this "gclid" in the URL.


1. Log in to your site and locate your Mouseflow Tracking Script

You will usually find your tracking script in the backend of your website.

2. Modify your Mouseflow Tracking Script

To ensure that you only record visitors coming from Google AdWords you will have to add the snippet below to your Mouseflow Tracking code:

if (window.location.href.indexOf('gclid') > -1) document.cookie = 'mf_record_user=1; path=/'; 
if (document.cookie.indexOf('mf_record_user=1;') > -1) {
// Mouseflow Tracking Snippet goes here...
}

An example of the modified Tracking Code would look as follows:

<script type="text/javascript">
if (window.location.href.indexOf('gclid') > -1) document.cookie = 'mf_record_user=1; path=/';
if (document.cookie.indexOf('mf_record_user=1;') > -1) {
// mouseflow tracking code
window._mfq = window._mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.defer = true;
mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
document.getElementsByTagName("head")[0].appendChild(mf);
})();
}
</script>

Once you've successfully updated your tracking code on all pages where you want the change to apply, please make sure to save your changes to the code.

When you've saved the changes you should begin seeing that all the recordings you get into Mouseflow originate from Google AdWords.

Note: Due to browser caching changes to the Tracking Code and Recording Script may take up to 48 hours to take full effect.

Did this answer your question?