Start by installing the FunnelQL Javascript library (see Installation).
Loading the FunnelQL database
Funnel Query Language is based on a IndexedDB database that can persist or expire with the browser session. You can configure the database using the init method.
1
$FQL.init({
2
expire:'session'
3
});
Copied!
Database Configuration Options
Option
Description
Default
expire
Database expiration.
session (could be never or a time in seconds)
The FunnelQL API is chainable and provides a onload callback.
1
$FQL.on('load')
2
.then(function(){
3
// database loaded
4
});
Copied!
Writing A Funnel
The Funnel data-set is based on tags that can be set with the following method:
1
$FQL.tag('tag-name');
Copied!
During navigation, URLs are automatically registered. The following method can be used to manually register a navigation:
1
$FQL.nav('URL or path/');
Copied!
Querying A Funnel
The following method can be used to perform a query based on a Funnel Query string or JSON:
1
$FQL.query("funnel query").then(function(result){
2
// result = true/false (boolean)
3
});
Copied!
The following method can be used to parse a Funnel Query string into JSON:
1
$FQL.parse("funnel query").then(function(json){
2
// json
3
});
Copied!
The following method can be used to perform an action as soon as a Funnel Query string or JSON matches the path of the visitor:
1
$FQL.on("funnel query").then(function(result){
2
// result = true
3
});
Copied!
Alternatively, the on method accepts a callback instead of a promise and multiple queries as a Array.
The library can provide detailed debug information including Performance API timings in the browser console. The following method can be used to enable debug mode or to retrieve it's status.