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

OptionsValueDescription
download_trackingtrueAutomatically tracks downloads. See below note
outgoing_trackingtrueAutomatically tracks outgoing link clicks
click_trackingtrueAutomatically 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:

OptionDefaultDescription
domainN/A (required)Required Project name in Woopra. Must be explicitly set for tracker to work.
cookie_namewooTrackerName of the cookie used to identify the visitor
cookie_domainWebsite domainDomain scope of the Woopra cookie. Use .domain.com to share the cookie across subdomains.
cookie_path/Directory scope of the Woopra cookie.
cookie_securetrue when https, false when httpWhether the secure flag is enabled for the Woopra cookie.
cookie_expirenew Date(new Date().setFullYear(new Date().getFullYear() + 2)) (2 years from now)Expiration date (javascript Date object) of the Woopra cookie.
click_trackingfalseTracks 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.
protocolhttpsThe protocol used to contact Woopra servers. http:// forces unsecure mode and // follows the page's protocol.
pingfalseDeprecated. Ping woopra servers to ensure that the visitor is still on the webpage
ping_interval12000Deprecated. Time interval in milliseconds between each ping
idle_timeout300000 (5 minutes)Idle time (in milliseconds) after which the user is considered offline
download_trackingfalseTrack 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_trackingfalseTrack external links clicks on the web page
outgoing_ignore_subdomaintrueDo not track links to subdomains as outgoing links
ignore_query_urltrueIgnores 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_campaignfalseEnabling this option will remove campaign properties from the URL when they’re captured (using HTML5 pushState)