0.0.1 • Published 1 year ago

@elbwalker/connector-datalayer v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

dataLayer connector for walkerOS

Made to be used with walker.js from walkerOS.

More detailed information and examples can be found in the documentation.

🤓 Usage

TODOs

  • multiple events with one dataLayer.push
  • Replace space with underscore in dataLayer event
connectorDataLayer({
  elb, // Function to push the events to, usually the WalkerOS.Elb
  // dataLayer, // the dataLayer to be used
  // name: 'dataLayer', // name of the dataLayer
  mapping: {
    
  }
});

Mapping

Typical GTM Trigger

  • gtm.js: All Pages

event is a static string data is an object with keys and value as Value for getMappingValue

API Commands

Typical gtag API commands like config, get, set, event, and consent are all translated to objects. Command parameters are added to data. For the event command the second parameter is used as the event name. For consent both granted and denied values are translated to either true or false.

gtag('event', 'foo', { bar: 'baz' }); // { event: "foo", data: { bar: "baz" }}
gtag('config', 'G-XXXXXXXXXX', { foo: "bar" }); // { event: "config G-XXXXXXXXXX", data: { foo: "bar" }}
gtag('consent' 'default', { ad_storage: 'denied' }); // { event: "consent default", data: { ad_storage: false }}
gtag('consent' 'update', { ad_storage: 'granted' }); // { event: "consent update", data: { ad_storage: true }}
gtag('set', 'campaign', { id: "abd" }); // { event: "set campaign", data: { id: "abc" }}