@elbwalker/connector-datalayer
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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" }}

Package Sidebar

Install

npm i @elbwalker/connector-datalayer

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

61.3 kB

Total Files

12

Last publish

Collaborators

  • alexanderkirtzel