The config
function is used to tell the tracker which project you're tracking. It also allows you to set a number of options that can affect your default pageview tracking (woopra.track()
No Args!!), the behavior, domains, and locations of cookies, how the ping works, etc.
The config
function supports key/value singleton argument:
woopra.config("cookie_name", "my_business_cookie");
Or an object of keys and values:
woopra.config({
download_tracking: true,
outgoing_tracking: true,
click_tracking: true
});
Auto tracking Configs
Options | Value | Description |
---|---|---|
download_tracking | true | Automatically tracks downloads. See below note |
outgoing_tracking | true | Automatically tracks outgoing link clicks |
click_tracking | true | Automatically tracks button clicks |
Note on 'download_extentions'
The default list is: avi, css, dmg, doc, eps, exe, js, m4v, mov, mp3, mp4, msi, pdf, ppt, rar, svg, txt, vsd, vxd, wma, wmv, xls, xlsx, zip
If you override the default, you this stops using our default list. You can use our list and include others like:
woopra.config({ domain: 'woopra.com', initialized: function () { woopra.config( 'download_extensions', woopra.config('download_extensions').concat('xml') ); } });
Custom Button Click Tags
When enabling 'click_tracking', this automatically tracks all button clicks. It's possible to add custom attributes to the button's HTML using
data-woopra-<property name>
in the code.For example:
data-woopra-hello="world"
Woopra will automatically pick up these attributes and send a new property 'hello' with the value 'world' with the button click event.
You can also track a custom button click event by using
data-woopra="custom button click event"
as well.This will send a separate event to Woopra ('custom button click event') instead of sending the standard 'button click' event for that particular button.
Configuring your Tracker
The Woopra tracker can be customized using the config function. The config options have some defaults for normal website tracking and with the exception of "domain
", can usually be left un-customized.
The tracker will not work, however without a domain
which is your project name in Woopra.
Find the list of options below:
Option | Default | Description |
---|---|---|
domain | N/A (required) | Required Project name in Woopra. Must be explicitly set for tracker to work. |
cookie_name | wooTracker | Name of the cookie used to identify the visitor |
cookie_domain | Website domain | Domain scope of the Woopra cookie. Use .domain.com to share the cookie across subdomains. |
cookie_path | / | Directory scope of the Woopra cookie. |
cookie_secure | true when https , false when http | Whether the secure flag is enabled for the Woopra cookie. |
cookie_expire | new Date(new Date().setFullYear(new Date().getFullYear() + 2)) (2 years from now) | Expiration date (javascript Date object) of the Woopra cookie. |
click_tracking | false | Tracks user click interactions with links and buttons. |
click_tracking_matcher_selectors | [ "a", "button", "input[type=button]", "input[type=submit]", "[role=button]" ] | An array of selectors to for click tracking. |
cross_domain | [] | Woopra will inject the user cookie automatically to links pointing to any domain listed in this configuration. |
protocol | https | The protocol used to contact Woopra servers. http:// forces unsecure mode and // follows the page's protocol. |
ping | false | Deprecated. Ping woopra servers to ensure that the visitor is still on the webpage |
ping_interval | 12000 | Deprecated. Time interval in milliseconds between each ping |
idle_timeout | 300000 (5 minutes) | Idle time (in milliseconds) after which the user is considered offline |
download_tracking | false | Track downloads on the web page |
download_extensions | ['pdf', 'zip', ...] | Overrides default list. See the note above for default extensions and ways to override the list. |
outgoing_tracking | false | Track external links clicks on the web page |
outgoing_ignore_subdomain | true | Do not track links to subdomains as outgoing links |
ignore_query_url | true | Ignores the query part of the url when the standard pageviews tracking function (track() with no args) is called |
map_query_params | {} | Object with URL parameter keys mapped to action property names. (e.g.{ ref: "campaign_name" } ) |
hide_campaign | false | Enabling this option will remove campaign properties from the URL when they’re captured (using HTML5 pushState ) |