Skip to main content

Installation

There are multiple ways to install and use the web source walker.js:

  • Google Tag Manager: Use the GTM to load walker.js.
  • NPM: Install walker.js as an NPM package.
  • Code: Directly include walker.js in the browser.

Configuration

There a few configuration options when creating a walker.js instance:

OptionTypeDescription
consentobjectInitial consent states, learn more under consent.
dataLayerbooleanAdds a dataLayer destination if enabled.
dataLayerConfigobjectConfig for the dataLayer destination, e.g. for consent.
defaultbooleanAdd a dataLayer destination and run automatically.
elbstringName of assign the elb function to the window
elbLayerobjectPublic elbwalker API for async communication.
globalsobjectStatic attributes added to each event.
instancestringName of the walkerjs instance to assign to the window
pageviewbooleanTrigger a page view event by default.
prefixstringAttributes prefix used by the walker.
runbooleanAutomatically start running.
sessionfalse or
SessionConfig
Configuration for session detection.
taggingnumberCurrent version of the tracking setup.
userobjectSetting the user ids including id, device, and session.
const walkerjs = Walkerjs({
dataLayer: true, // Add the dataLayer destination
dataLayerConfig: {
consent: 'functional', // Require functional consent
},
elb: 'elb', // Assign the elb function to the window
globals: {
tagged: false, // A static global attribute
},
pageview: true, // Trigger a page view event with each run
run: true, // Automatically start running
session: {
storage: true, // Use the storage for session detection
consent: 'marketing', // Require marketing consent to access storage
length: 60, // Session length in minutes
},
tagging: 1, // Current version of the tagging
});

During a run you can still use globals and tagging to update the configuration.