New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GTM Samples #1218
Comments
Good news! We do support The README there is not correct quite yet, so please ignore that. We don't have a sample, but that's something we can add to the list! |
Thanks for pointing me in the right direction @JustinBeckwith I can't seem to get the auth going, is there something I'm doing wrong or missing below? I've created an API key through the google console as the other guides state. Edit: I'm starting to realize it may have been created under the incorrect organization, so I'll give that a try later when I'm back at a computer. Edit2: I ended up using a service account and JWT, I had to add the provisioned service account email to the GTM container and give it proper access. import config from './config/config';
import { tagmanager_v2 as gtm } from 'googleapis';
const tagManager = new gtm.Tagmanager({ auth: config.gtmApiKey });
const gtmAccounts = new gtm.Resource$Accounts(tagManager);
gtmAccounts
.get({ auth: config.gtmApiKey, path: 'accounts/91730' })
.then((x: any) => console.log('SUCCESS!', x))
.catch((x: any) => console.log('KABOOM!', x)); |
Is the example still in the works? Documentation or and example would be very helpful. |
@bcoe I did not. I plan on getting to this next week though. I'll post an example unless you beat me to it. |
I'm also interested in sample code but first what I'd like to accomplish... In today's age of importing libraries, is it now possible to use GTM without having to add a script tag snippet into your header? I noticed that when you add the gtm.js as script snippet - it downloads about 200KB of JS including itself and some dynamically loaded Facebook tracking code (fbevents.js) - even with server-side compression. I'm hoping that there is alternative API solution where I could get around this ancient attach script approach - eliminate the 200KB download - and interact with an API instead. |
Is there no progress or update on this? |
Nope. We have no immediate plans here beyond the examples generated in the jsdoc comments. Happy to accept PRs! |
@bcoe I think I ended up abandoning this, and we just rolled our own library that we inject through GTM since we have a centralized GTM already on hundreds of sites. It seems that a few of our painpains have been addressed through the standard UI for GTM, but it's still nice to have greater control, and there are still a few things we prefer to have in our own codebase. It would be really nice though to be able to just utilize GTM's libraries rather than reinvent the wheel in some places. Revisiting this now, it may be possible that we would build this out differently. It can get segmented between GTM and our codebase. It's also a pain writing in old JS so being able to write modern JS and transpile it for targeted browsers is nice. I would love to think GTM could/would do on-the-fly modules/components, ut I doubt they do, especially as you mention the large overhead for it. We will have to continue bootstrapping earliest in the head of the document so that we can beat other libraries to hooks -- I have seen times where other libs will prevent the propagation on events so GTM never sees it. |
Greetings, we're closing this. Looks like the issue got resolved. Please let us know if the issue needs to be reopened. |
Does this library support Google Tag Manager?
I haven't found anything about it although GTM seems to link to this repo and its examples folder but lacks any examples for such.
In-links
Searching Issues
I found these but they seem to be closed out
The text was updated successfully, but these errors were encountered: