Lead Source Tracking

Overview

WP Fusion includes the ability to detect lead sources in URL parameters, such as those used with Google Analytics. You can even easily create your own lead source tracking scheme to collect just the data you need from your visitors.

The system is quite versatile. It can look for a variety of common lead source parameters passed in URLs to your site and store these as a cookie when the user first visits your site.

If a visitor then registers on your site, makes a purchase, or submits a WP Fusion enabled form, the detected lead source parameters will be sent to your CRM.

The cookie is valid for 90 days. So even if a user leaves your site and comes back later to make a purchase, you can still capture the source that brought them to you in the first place.

Note: This feature does not work properly on WP Engine or other hosts that don’t let you edit your site’s caching settings.

Google Analytics

If you’re using Google Analytics’ Campaign URL Builder, Google will generate tracking links to your site that look like https://mysite.com/?utm_source=facebook&utm_campaign=summer_ad.

You can enable each of the various Google Analytics tracking variable for sync from the Contact Fields tab in the WP Fusion settings.

Note: By default WP Rocket caches URLs with Analytics leadsource variables in them. This will prevent WP Fusion’s lead source tracking from working. You can follow this tutorial to exclude the Google query string parameters from WP Rocket’s cache.

Custom Lead Source Tracking

To enable custom lead source tracking, locate the leadsource field in the Contact Fields list and map it to a field in your CRM. Make sure to check the Sync box to enable the connection.

Structure the URL to your site like https://mysite.com/?leadsource=custom_leadsource. Anything after the leadsource parameter in the URL will be synced. Using this method you can set up your own lead source tracking strategy however you see fit.

Referrer and Landing Page

The fields Original Referrer and Landing Page are a bit different in that they don’t use a URL parameter for tracking.

  • Original Referrer: This tracks the URL a user followed to get to your site. If this is enabled, the referrer URL will be recorded on their first visit.
  • Landing Page: This tracks the page the visitor landed on when they came to your site for the first time.

How it works

When a visitor lands on your site with one of the tracked parameters, WP Fusion will set a cookie, either wpf_leadsource (for the UTM and URL parameters) or wpf_ref for the Original Referrer and Landing Page.

You can see the cookies set by WP Fusion using your browser’s developer tools. If the cookies aren’t being set, your page is probably cached.

This cookie is valid for 90 days. If any any time during that period, a contact record is created for that visitor by WP Fusion, the tracked values will be extracted from the cookie and merged into the API data sent to create the new contact record.

This works any time WP Fusion creates a contact record— a form submission, abandoned cart, product purchase, or regular registration. It does not work when a contact record is added to your CRM by another plugin, since other plugins wouldn’t know to look for cookies set by WP Fusion.

Also note that WP Fusion only sync the lead source data when a new contact record is created. It won’t send the data to an existing contact record, to avoid overwriting lead source data you may have already collected for a contact. This can be considered First Referrer tracking.

Caching

Note that the lead source tracking relies on cookies, which often aren’t compatible with caching. For example this functionality does not work on WP Engine.

Generally speaking, if the cookies aren’t being set, make sure your landing page is excluded from cache, or the query variables you’re tracking are set to bypass the cache. It may also be helpful to bypass the cache when the wpf_leadsource or wpf_ref cookies are set (though this could degrade performance).

Note that with WP Rocket, any URL with UTM parameters is cached by default, which means the lead source tracking won’t work. To override that you’ll need to download and customize the helper plugin WP Rocket | Ignore Query Strings.

Developers

If needed you can change the name of the cookies that are used for WP Fusion’s lead source tracking. The two filters are wpf_leadsource_cookie_name and wpf_ref_cookie_name.

For example to prefix the two cookie names with an underscore:

add_filter( 'wpf_leadsource_cookie_name', function() {
	return '_wpf_leadsource';
} );

add_filter( 'wpf_referral_cookie_name', function() {
	return '_wpf_ref';
} );

Was this helpful?