Setting Javascript page defaults

Avatar

By Zeno

updated about 1 month ago

If you would like organic views to track correctly, i.e. those that come to your page with no context and not via your generated links, then you will need to set some defaults on the page.

In other words, you need to tell the tracker that "when no context is available, here is the default funnel and page to use".

This is important if you wish to use FunnelFlux tracking on sites that receive a lot of organic and direct views.

Unlike Google Analytics, FunnelFlux tracking is explicit and can only occur if the tracker knows what funnel and page to attribute a view to, as it needs to determine the node the user is on.

Below you can learn how to set defaults on a page.

The fluxDefaults Object

To set defaults on a page you just need to embed another script that comes before our global snippet.

This could be done manually, with a tag manager like GTM, or server-side with PHP or some other language. It's up to you.

These code snippets are provided in our UI when editing a specific lander/offer, or in the funnel builder when generating direct links.

If you get these from the funnel builder they will already include a funnel ID. If from the page settings, they will only include the page ID:

[ IMG ]

To use these, simple add this snippet to the top of your page.

These will not conflict with your tracking URLs as the URL parameters are always treated with higher priority.

Not sure of the funnel ID to set?

You can turn on the resource ID column on the funnels page, or just open the funnel in the editor and check the URL – the funnel ID will be at the end, i.e.

https://ui.funnelflux.pro/funneleditor/FUNNEL_ID_HERE

Organic Site Tracking

If you have a full website with organic traffic, and you run separate marketing campaigns (which may involve different pages), we'd recommend setting up a default site funnel.

You can then get all your default snippets from a single funnel and know clearly where direct views will be tracked.

Additionally, you can set a default traffic source by adding ts: TRAFFIC_SOURCE_ID to the fluxDefaults object.

This can be useful if you often have parameters being passed in direct links, such as UTM parameters or refer tags.

Without context, traffic will come under "organic" traffic. This is a pseudo traffic source for when no traffic source is known.

Because it has no config, it does not track any URL parameters. You can side-step this by making your own default traffic source with some generic parameters that get tracked.

For example:



Then fluxDefaults could be updated to e.g.

<!-- Optional page default parameters -->
<script>
var fluxDefaults = {
  f: 'default_funnel_id',
  p: 'default_page_id',
  ts: 'default_traffic_source_id'
}
</script>


Did this answer your question?