Giter VIP home page Giter VIP logo

autodata's Issues

Configuration override issue

The resolution of this issue has two objectives

  • Fix the root cause of the initial issue
  • Extend this "fix" to a more global approach of configuration override

1. Initial issue
autoData allow common configuration override like this :
autoData.init({ common: { tms: { name: 'tealium' }, plugins: { eventTracker: { attributePrefix: 'data-evt-', trigger: 'att1', attributes: ['att1_1', 'att1_2'] } } }, custom_template: { plugins: { eventTracker: { attributes: ['att2_1', 'att2_2'] } } } });

custom_template values override common ones. In this simple case, initialized eventTracker attributes are 'att2_1' and 'att2_2'. The issue appears when common arrays are wider (see below).

autoData.init({ common: { tms: { name: 'tealium' }, plugins: { eventTracker: { attributePrefix: 'data-evt-', trigger: 'att1', attributes: ['att1_1', 'att1_2'] } } }, custom_template: { plugins: { eventTracker: { attributes: ['att2_1'] } } } });

In this other case, initialized eventTracker attributes are 'att2_1' and 'att1_2'. They are like "merged" strangely , where it should be 'att1_1', 'att1_2' and 'att2_1' (really merged) OR 'att2_1' only (pure override).

To fix it, a merge is preferred. As common values, they shouldn't be removed on arrays. It introduce the final though :)

2. Configuration override revision

Using configuration override, arrays are merged pragmatically between common values and specific values. Strings are not affected.

autoData.init({ common: { tms: { name: 'tealium' }, plugins: { eventTracker: { attributePrefix: 'data-evt-', trigger: 'att1', attributes: ['att1_1', 'att1_2','att_generic'] } } }, custom_template: { plugins: { eventTracker: { attributes: ['att2_1', 'att2_2','att_generic'] } } } });

This configuration should result on 'att1_1', 'att1_2', 'att2_1', 'att2_2' and 'att_generic. It should remove duplicates values to be optimal.

documentations improvements

Some notes about the documentation:

Introduction

you need to add more context, quite hard to understand what the library does. You should add information about driver, abstraction, what a TMS is. Remove the WIP(Autotada).

The introduction should also specified the scope of this library, (browser support, stack support: angular, jquery, react, etc ...)

API

You should add more information about where the autoData.init should be call. Also you should add the script tag to install the library.

The init function should contains the default settings and the most used settings, each setting should have more detailled information. ie, what are valid tms values ?

autoData.sendPageView when this method should be used ? does the result is the same per tms ? (same comment for others methods)

Debug

Does the library have a debug or verbose mode ?
Does the library can introduce performance issue with user interaction ?

Add dataLayer name override on GTM context

To allow user putting its own dataLayer name (to prevent conflict or to scope events to a specific GTM), a new facultative parameter is added to autoData initialization, under the "tms" element, with the name "dataLayerName". GTM sender is modified to handle this overriden name :

export const sender = (tag, type) => { if (!window.dataLayer) { window.dataLayer = []; } window.dataLayer.push(tag); };

By default, its name is still "dataLayer".

Critical security issue in ejs < v3.1.7

There seems to be a critical security issue in ejs < 3.1.7, but autodata requires webpack-bundle-analyzer ^2.9.0, both in autodata's latest (unpublished) version 0.16.0 and in the latest published version 0.12.0.
Updating this dependency to > v4.0.0 should resolve the issue.

npm audit

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Critical      │ Template injection in ejs                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ ejs                                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=3.1.7                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ autodata                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ autodata > webpack-bundle-analyzer > ejs                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://github.com/advisories/GHSA-phwq-j96m-2c2q            │
└───────────────┴──────────────────────────────────────────────────────────────┘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.