Overriding default Javascript behaviour

Avatar

By Zeno

updated about 1 month ago

Like with page default tracking params, you can also override the default options used by our global JS code.

Those options affect our helper functions primarily:

  • urlRewrite
  • actionLinkRewrite
  • resolveTokens (global)
  • cookieAllowed
  • isActive

Options can manually overridden by adding a fluxOptions object before our global JS code. 

An example object:

<!-- Optional tracking option overrides -->
<script>
var fluxOptions = {
  urlRewrite: true,
  actionLinkRewrite: true,
  cookieAllowed: true,
  resolveTokens: ['{hit}','{isp}']
  isActive: true
};
</script>

urlRewrite

Setting this to false will stop the automatic URL rewriting that happens when a view event tracks.

actionLinkRewrite

Setting this to false will stop the automatic action link updates that happen when a view event tracks.

resolveTokens

Tokens to resolve can (and should be) set in events directly, since not all events need tokens in their responses.

However, you can also set a global resolveTokens value and this will result in a default being used in all events.

cookieAllowed

Setting this to false will prevent cookies being created by our JS.

isActive

Lastly, setting this to false will cause our JS methods to all cease functioning. You can set this false to prevent tracking, then set it to true once a user gives consent.

If using this, you should manually send a flux.track("view") event after isActive has been set true.

Did this answer your question?