Track transitions/virtual page views in single-page apps.
Track non-page view events, such as in-page dialogs or video/media playback.
NOTE: If you use Google Tag Manager to use Leadfeeder Tracker, remember to add <script> before the script and </script> to the end of the script.
The Leadfeeder tracker script exposes a set of methods for the web page to call if needed. All these methods exist under the window.ldfdr -object in the page.
Sends a page view event. It supports arguments as an object.
pageTitle: "Example page"
If the arguments are not present, it will default to window.location.href for pageUrl and document.title for pageTitle.
For SPA tracking, calling window.ldfdr.pageview()without arguments after a state change is usually enough as new pageUrl and pageTitle will be automatically picked up.
Additionally, you might want to prevent double tracking by disabling automatic sending of the tracking event on each page load. This change needs to be done inside the code snippet used for loading the tracking script (check GTM or your website's code).
If you use Leadfeeder’s Google Tag Manager template, another option is that you unselect Automatic tracking as shown in the picture below:
Returns an array of all tracker instances on the page. See getTracker() below for details on how to interact with the tracker instances.
Get a tracker instance by trackerId. For the tracker instance following methods are supported:
var tracker = window.ldfdr.getTracker("abcdef");
// Sends a pageview to specific tracker, supports
//same arguments as pageview() above
You can obtain the Leadfeeder clientId with the following call:
ClientID is the visitor ID that is stored in the Leadfeeder cookie. It matches to the lf_client_id field that is returned from the Leadfeeder API's visits end-point.
As a default Leadfeeder cookie expires in two years (730 days). If wanted, you can use the following to make the cookie to expire after a shorter time:
If you use Leadfeeder’s Google Tag Manager template, another option is that you set up the expire time in Google Tag Manager settings as shown in the picture below:
NOTE: Please note when changing the cookie expiration time, this setting is taken into consideration only if you have enabled cookies in your Leadfeeder cookie settings here. When it comes to using GTM, this requires that you are using the latest version of Leadfeeder script in your GTM - check the template in GTM for possible updates.
STEP 1: Add a new Custom HTML tag in your Google Tag Manager.
STEP 2: Name as appropriate.
STEP 3: Add the following code to HTML section:
STEP 4: Configure a trigger for "History change".
STEP 5: Test in Google Tag Manager’s Debug mode.