tagmanager-build-tool
v1.2.8
Published
A tool to build tagmanager html, javascript and tpl entities.
Downloads
4
Readme
TBT - Tagmanager build tool
Description
Tagmanager build tool is a unofficial tool which downloads and uploads your Tagmanager tags, variables and templates. This will enable you to work in a code editor of choice and version your code.
Installation
Run
npm install -g tagmanager-build-tool
Create a Google Cloud Project and connect enable the Tagmanager API.
After enabling the API create a service account with access to use that API.
Create a new folder where you want to work and optionally run
git init
.Download the key as json and save it in the root as
gcp-sa-key.json
.Create a
.env
file. You can find the required id's in your tagmanager url<https://tagmanager.google.com/#/container/accounts/<accountid>/containers/<containerid>/workspaces/<workspaceid>
ACCOUNT_ID=<your account id>
CONTAINER_ID=<your container id>
USER_EMAIL=<service account email address>
USER_NAME='<This name you want to display when you do uploads>'
- Run
tbt pull
to see if everything works.
Options
Run tbt
to see help or tbt <command>
to see the help for each command.
Usage: index [options] [command]
Tagmanager build tool
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
fetch Fetch changes from Tagmanager without extracting code.
pull Pull changes from Tagmanager and extract code.
build Build json files so they are ready for upload.
push [options] Push changes to tagmanager. Include a comma seperated list of paths to process or omit to process all.
help [command] display help for command
Workflow
Fetch
Download all container data in JSON format. This is a direct download and is mostly usefull for obtaining the latest fingerprint.
Pull
Download all container data in JSON format and extract custom code in seperate files. Allowing you to easily modify or version code in your own code editor.
Build
Build requests in json files which can be used for upload. Will contain all of your modified code.
Push
Upload all or specified (by build filename) tags, variables or templates.
:warning: Fingerprinting errors: When running the update function and the fingerprints have changed (e.g. somebody did a change in tagmanager) the upload will fail. Run fetch to get the latest fingerprints. Build to get the new request objects and push to try again.