Create smooth tracking using Session ID
Zeno avatar
Written by Zeno
Updated over a week ago

If you are encountering issues where user identity is being lost and they turn up as "organic traffic" when they shouldn't, or if you need their journey to continue where it left off but from a different device/location, you can use our session ID variable to tell the tracker the identity of the user.

Our session IDs last 7 days and are specific to each funnel the user visits.

Using session ID is easy and can be handled through our javascript tracking - you can grab the universal code for a funnel in the advanced settings area of the funnel editor.


Basic implementation

Take the universal JS code for your funnel and put it in the <head> section of your landing page. Note the following code at the bottom:

fflux.track({ 
    timeOnPage: false,
    timeOnPageResolution: 3000,
    noCookies: false,
    tokenInjection: {
      intoUrl: false,
      intoForms: { selector: null },
      intoLinks: { selector: null },
      tokens: {}
    }
});

Here we can use the token injector to pass the session ID into action links on the page. To do this, change the code to:

fflux.track({ 
    timeOnPage: false,
    timeOnPageResolution: 3000,
    noCookies: false,
    tokenInjection: {
      intoUrl: false,
      intoForms: { selector: null },
      intoLinks: { selector: 'a.flux_cta' },
      tokens: { flux_sess: '{session-id}' }
    }
});

Now all you need to do is add the class flux_cta  to any <a> elements on the page that are your action links, so that the injector can find these and append the FunnelFlux session ID to them.

I.e. modify your action links from:

<a href="https://tracker.com/?flux_action=1">Some text</a>

to this:

<a class="flux_cta" href="https://tracker.com/?flux_action=1">Some text</a>

Once you do this, the page will load and the JS will modify these action links to include the session value, i.e.

https://tracker.com/?flux_action=1&flux_sess=xxxxxxxxxxxxxx


Session continuation from other sources

Note that FunnelFlux tracking sessions last 7 days, and that the session ID lets you resume a tracking session within the same funnel - so it is not a replacement for the visitor ID parameter (passed with flux_visitor) that is used to infer lifetime revenue for a visitor from one funnel to another.

However, this session ID can also be passed to let users reenter a funnel after navigating away, or if coming back from another device or IP.


Example 1:

Users enter your funnel and submit a form that redirects them away to some site that you don't control. Eventually they will be redirected back to you and you want to ensure they do not reappear as a new user, losing their connection to the original incoming data (e.g. tracking fields).

In this situation, you could pass the session ID to this external system using the link injector, or by using the token {session-id}  in your lander/offer URL in FunnelFlux.

When this system returns the user back to you, have it pass flux_sess=THE_ID back to you in an action link or entrance link, and the user journey will be picked up where it last ended.

This is more effective than passing visitor ID, as that does not prevent a new entrance happening or guarantee that the visitor will carry their original tracking data.


Example 2:

You send users to a lander where they have an opt-in form that will send an email follow-up. You have the email sending users to some new page/node within the same funnel.

In this situation, the session ID is invaluable as it will let the user continue their session, even from another device.

To do this you can use the form injector function:

fflux.track({ 
    timeOnPage: false,
    timeOnPageResolution: 3000,
    noCookies: false,
    tokenInjection: {
      intoUrl: false,
      intoForms: { selector: 'form.form_class' },
      intoLinks: { selector: null },
      tokens: { flux_sess_funnelName: '{session-id}' }
    }
});

Here we have set it to inject a hidden field of flux_sess_funnelName  into a form with the class of form_class . It will be up to you to do the following:

  1. Identify the correct form selector to use, e.g. form, form.class, etc.

  2. Set the field name to something that your email system is expecting and will log/store for the user. I suggest putting funnel name in the field name somewhere, since you might do this for many different funnels

Once submitted you should have a contact in your email system that has a session ID field name with some value stored under it.

You can now personalise the email response to this contact using whatever tokens/personalisations your system offers.

So, for some call to action in your email, you may be able to use a URL such as:

https://tracker.com/...&flux_sess=##flux_sess_funnelName##

Consider here if you are tracking this email as a lander in FunnelFlux (which you can do!).

If so, use a flow like this in FunnelFlux:

For the email, you can track opens by embedding an entrance link in the email as an image pixel, along with the flux_sess variable. Note that this kind of tracking is unreliable since many email clients block remote images.

An example embed would be:

<img src='https://tracker.com/?flux_fts=xxx&flux_fn=xxx&flux_sess=##SOME_PERSONALISATION##' alt='' width='1' height='1' />

Then, for the CTA in your email, you can use the action link from Example Email to Lander 2, using the organic params + session ID:

https://tracker.com/?flux_action=1&flux_f=xxx&flux_ffn=xxx&flux_sess=##SOME_PERSONALISATION##

This action code specifies the funnel ID, what node the user is coming from (the email, so will register as a clickthrough) and again re-declares the existing session so that it won't create a new entrance.


Navigation without action links

Another use for session ID is to allow navigation between nodes/pages without needing action links.

This is very useful when using platforms like Shopify, ClickFunnels, etc. where you can't and don't want to change your page's links to FunnelFlux links.

Instead, you can use the universal JS for a funnel on your pages, replicate a landing page flow in FunnelFlux i.e. create landers/offers that have the same URLs as those users will be visiting, and can then use session ID passing to tell FunnelFlux to continue a user journey.

Normally, the JS would make new entrances each time a person appears on a page as it can't determine with certainty based on referrer if the user organically navigated to your site, or came from a page in the current funnel, or a page in a different one.

So, you can use the link injector:

fflux.track({ 
    timeOnPage: false,
    timeOnPageResolution: 3000,
    noCookies: false,
    tokenInjection: {
      intoUrl: false,
      intoForms: { selector: null },
      intoLinks: { selector: 'a' },
      tokens: { flux_sess: '{session-id}' }
    }
});

Here I have set the links selector as just "a", so it will add flux_sess=xxx to all links on the page. You can modify this to be more specific if you wish.

Now when a user lands on page A, they can click a normal site link to page B and FunnelFlux will track this and ensure the view is counted on page B properly without creating a new entrance.


Using with email

I have already mentioned email in example 2 above, but wanted to reiterate an important distinction here.

The session ID should be used only if you are sending users to a node in the same funnel that you got the session ID from.

If you are sending users to a different funnel for the email follow up, don't pass session ID under flux_sess  as the session will be invalid for the new funnel.

Instead, pass visitor ID to your form and then append flux_visitor=ID  to your entrance/action links in the follow up email sequence. This will connect the visitor to the original funnel, allowing you to see lifetime revenue and indirect conversions.


Using PHP

PHP is only likely to be useful for this functionality if you are using tracking links and for some reason want to avoid the JS.

In this case, you can use the {session-id}  token in your lander/offer URLs in FunnelFlux, then grab this value from the URL and echo it in your links on page, e.g.

<a href="https://tracker.com/?flux_action=1&flux_sess=<?= $_GET['param'] ?>"

However there are not many situations where this is going to be more useful than using the javascript methods.

Did this answer your question?