@d-cat/utility-custom-dimension-builder
v3.1.0
Published
Utility method that transforms an objects value to DDM values.
Downloads
14
Readme
Getting started with @d-cat/utility-custom-dimension-builder
Utility template that is designed for @d-cat/tag-manager to return a @d-cat/ddm-core object based on a comma seperated string.
Install
npm i @d-cat/utility-custom-dimension-builder
Usage
An array with objects should be passed where the key stands for the key of the returned object and the value DDM keys as comma seperated string. The first key that's found is returned.
import { set } from '@d-cat/digital-data-manager';
import customDimensionBuilder from '@d-cat/utility-custom-dimension-builder';
// set page.host
set('page.host', 'https://ziggo.nl');
// set user.cust_status_ziggo
set('user.cust_status_ziggo', true);
const arr = [
{
key: 'cd1',
value: 'page.host',
},
{
key: 'cd40',
value: 'user.custStatus.ziggo, user.cust_status_ziggo',
},
];
const outputObject = customDimensionBuilder(obj); // { cd1: 'https://ziggo.nl', cd40: true }