Skip to content

Javascript reference

Arnaud PICHERY edited this page Oct 19, 2018 · 3 revisions

This page details all functions of the _wt1Q Javascript API

trackPage

Tracks the view of a page.

Takes an optional argument (Javascript object) to set custom variables for the page view.

/* Without custom variables */
_wt1Q.push(["trackPage"]);
 
/* With event-scoped custom variables */
_wt1Q.push(["trackPage", { "myvar" : "myvalue", "myvar2" : "myvalue2" }]);

trackEvent

Tracks a custom event on the page. This method can be called from any Javascript code.

Takes an optional argument (Javascript object) to set custom variables for the event.

/* Without custom variables */
_wt1Q.push(["trackEvent"]);
 
/* With event-scoped custom variables */
_wt1Q.push(["trackEvent", { "myvar" : "myvalue", "myvar2" : "myvalue2" }]);

setVisitorParam

Sets a visitor-scoped custom parameter.

CAUTION: This method actually only enqueues an order to clear the parameters. The parameters will be actually cleared on the subsequent call to trackPage or trackEvent.

Takes two arguments:

  • Parameter name
  • Parameter value

Example:

_wt1Q.push(["setVisitorParam", "myVisitorId", "value"]);

The parameter will be set on all subsequent tracking calls.

delVisitorParam

Removes a visitor-scoped custom parameter.

CAUTION: This method actually only enqueues an order to clear the parameters. The parameters will be actually cleared on the subsequent call to trackPage or trackEvent.

Takes one argument: the name of the parameter to delete.

Example:

_wt1Q.push(["delVisitorParam", "myVisitorId"]);

The parameter will be removed on all subsequent tracking calls.

clearVisitorParams

Removes all visitor-scoped custom parameters.

CAUTION: This method actually only enqueues an order to clear the parameters. The parameters will be actually cleared on the subsequent call to trackPage or trackEvent.

Takes no arguments.

Example:

_wt1Q.push(["clearVisitorParams"]);

The parameters will be removed on all subsequent tracking calls.

setSessionParam

Sets a session-scoped custom parameter.

CAUTION: This method actually only enqueues an order to clear the parameters. The parameters will be actually cleared on the subsequent call to trackPage or trackEvent.

Takes two arguments :

  • Parameter name
  • Parameter value

Example:

_wt1Q.push(["setSessionParam", "mySessionId", "value"]);

The parameter will be set on all subsequent tracking calls.

delSessionParam

Removes a session-scoped custom parameter.

CAUTION: This method actually only enqueues an order to clear the parameters. The parameters will be actually cleared on the subsequent call to trackPage or trackEvent.

Takes one argument: the name of the parameter to delete.

Example:

_wt1Q.push(["delSessionParam", "mySessionId"]);

The parameter will be removed on all subsequent tracking calls.

clearSessionParams

Removes all session-scoped custom parameters.

CAUTION: This method actually only enqueues an order to clear the parameters. The parameters will be actually cleared on the subsequent call to trackPage or trackEvent.

Example:

_wt1Q.push(["clearSessionParams"]);

The parameters will be removed on all subsequent tracking calls.

setSizeCapture

Enables or disable the capture of browser and screen size. Size capture is enabled by default.

The parameter is not preserved across page loads.

Takes one argument: "true" or "false".

Example:

/* Disable size capture */
_wt1Q.push(["setSizeCapture", "false"]);