❌ The script will no longer work.
This is the official source code repository for the funnelbranch.js
script.
For more information, please visit www.funnelbranch.com.
Include the following script tag on every HTML page.
<script src="https://js.funnelbranch.com/funnelbranch.js?projectId=<PROJECT_ID>"></script>
The script tag can also be initialized with query parameter options, like this
<script src="https://js.funnelbranch.com/funnelbranch.js?projectId=<PROJECT_ID>&cookieDomain=<COOKIE_DOMAIN>&enableLocalhost=true"></script>
Have a look at the manual setup guide below for an overview of all options.
First: include the same script tag on every HTML page, but omit any query parameters.
Second: manually initialize Funnelbranch via the Funnelbranch.initialize(...)
method.
<script src="https://js.funnelbranch.com/funnelbranch.js"></script>
<script>
const funnelbranch = Funnelbranch.initialize('<PROJECT_ID>', options);
// The second "options" parameter is not mandatory
</script>
Here's an overview of all possible options.
type Options = {
controlGroup?: 'A' | 'B';
// Default: undefined
cookieDomain?: string;
// Default: current domain
enableLocalhost?: boolean;
// Default: false
trackClientUrlChanges?: boolean;
// Default: true
trackClientHashChanges?: boolean;
// Default: false
};
Custom actions can be submitted via the submitAction()
method.
funnelbranch.submitAction('<ACTION_NAME>');
To stop tracking client-side URLs and cancel all browser API subscriptions, use the destroy()
method.
funnelbranch.destroy();
Note that if you're using automatic script tag initialization,
the Funnelbranch instance is automatically made available under window.funnelbranch
.
Check out the official Funnelbranch Script Wrapper (NPM) module for using this script with SPA frameworks like React and Angular.