@juicyllama/nestjs-google-tag-manager-api
v0.2.1
Published
A NestJS app for integrating with Google Tag Manager API
Readme
Install
npm i @juicyllama/nestjs-google-tag-manager-apiUsage
- Create an Oauth2 application in your Google API Console. Google then provides information you'll need later, such as a client ID and a client secret.
- Activate the Tag Manager API in the Google API Console. (If the API isn't listed in the API Console, then skip this step)
- Add the client ID and a client secret to the
.envand boot up your NestJS application - Authenticate your NestJS application with GTM (#Oauth2)
- Integrate your NestJS application with the relevant modules (e.g. endpoints) required
You can checkout the Sandbox for an example implementation.
Oauth2
Once you have the module running in your app, it automatically exposes the endpoints required to connect via OAuth2
Visit: /app/gtm/auth and connect to your GTM account
Cache / Redis
As standard the app will use local memory for storing the OAuth Tokens which is not best practice as you will need to reauth each time you restart the service (and the memory is cleared).
We recommend using Redis which ships out of the box, provide your redis environment values and the cache will revert to redis.
REDIS_PORT=localhost
REDIS_HOST=6379Types
We have typed each resource type and have exported them for your use.
You can import them into your code and reuse them.
Testing
We are using mock data (mirrored from the Google Tag Manager documentation) to perform testing.
