gtm-batch-delete
v2.0.4
Published
Node gadget to delete elements from a GTM container JSON file, specified by list of element IDs or names.
Downloads
16
Readme
gtm-batch-delete
Node gadget to delete elements from a GTM container JSON file, specified by an array of element IDs or element names.
Export a Google Tag Manager container then import a new version minus the elements you've specified.
Pre-requisites
Requires NodeJS
Optional installation via NPM
npm i gtm-batch-delete
Imported as a package
const gtmBatchDelete = require('gtm-batch-delete')
// To delete tags by ID
const cleansedContainer = gtmBatchDelete("./path/to/container.json", "tag", "1,2,3")
// To delete triggers by ID
const cleansedContainer = gtmBatchDelete("./path/to/container.json", "trigger", "1,2,3")
// Or if you want to use tag names instead.
const cleansedContainer = gtmBatchDelete("./path/to/container.json", "tag", "tag one,tag two,tag three")
Run via CLI
# To delete tags
node gtmBatchDelete.js --container ./path/to/container.json --type 'tag' --elements 1,2,3
# To delete triggers
node gtmBatchDelete.js --container ./path/to/container.json --type 'trigger' --elements 1,2,3
# Or if you want to use tag names instead
node gtmBatchDelete.js --container ./path/to/container.json --type 'tag' --elements 'tag one,tag two,tag three'