PXL Events
Integration
Import
import * as pxl from "@mod-consilio/js/pxl";
Send events
Send a pxl event:
pxl.sendPxlEvent("mymodule:myevent");
Send a pxl event with custom data (see Custom data fields below):
pxl.sendPxlEvent("mymodule:myevent", { ds_mystring: "some string", dn_mynumber: 1234 });
Options
Set the global options for all subsequent pxl calls:
let options = {};
pxl.setOptions(options);
The following options can be set in the options object:
recordurl: Base url to which to send PXL events. Defaults to"/.wh/ea/pxl/".altsamplerate: Sample rate for the alternative record url as a fraction of the number of events, for example, setting it to1/100(or.01) sends 1 in 100 events to the alternative record url. Defaults to0(no sampling).altrecordurl: Alternative record url. Defaults to"/.wh/ea/pxl/alt/".sessionexpiration: The number of days the user id is valid. Defaults to30.nobrowserenvironment: Set to true to omit some browser context fields (bu,bsandbp). This option can be used to reduce the length of the pxl url. Defaults tofalse.debug: Set totrueto enable debugging in the JavaScript console. Defaults to the value of thepxldom debug flag.
To set specific options when sending pxl event, supply an options object to the sendPxlEvent call:
let options = {};
pxl.sendPxlEvent("mymodule:myevent", { ds_mystring: "some string", dn_mynumber: 1234 }, options);
PXL QUERY VARIABLES
Pxl event fields
Base pxl event fields, identifying the event, user and/or session.
pePxl eventpiUser identifier, which is a permanent identifier for the user across browser sessions and valid for at most 30 dayspsUser session id, which is tied to the current browsing session of the userppPage session id, which changes after each page loadpcEvent counter for this page session. 1-based.prAlternative record URL sample rate
Browser context fields
The actual referrer and browser identification for the page sending the event, along with some extra information about the browser environment. These might differ from the referrer and user agent in the access log if using a CDN.
blThe current url (location) of the pagebrThe referrer, if knownbtUser agent triplet (platform-name-version)bdDevice type (one ofdesktop,mobileortablet), if knownbuUser agent stringbsScreen size, if known (<width>x<height>)bpDevice pixel ratio, if known
The last three fields (bu, bs and bp) can be omitted if not wanted or if the url might become too large by setting the nobrowserenvironment option.
Custom data fields
Fields containing custom data which can be used for analyzation of the events. XXX denotes a custom string consiting of a-z, 0-9 or underscores, eg 'ds_clientid'
ds_XXXText datadn_XXXNumber datadb_XXXFlag data