简体   繁体   中英

Do I need jQuery for Google Tag Manager to work? Using it with AngularJs

I can't seem to find any answers on this. I've got an AngularJs application, which I do not need jQuery for. I've added Google Tag Manager using Angulartics but I'm getting a 'jQuery is not defined' error in the console. Do I need to include jQuery just for GTM? Since jQuery is no longer so much of a standard this surprises me? And it's vaguely annoying! Anyone know a way around it or can I just ignore the error and everything will work anyway?

No, you do not need jQuery.

The only relation between jQuery and GTM that I know of is that the code of the built-in selector engine so much resembled jQuery that Google agreed to add a jQuery copyright notice (at least that is what Simo Ahava told in one of his GTM trainings, and he is a Google Certified Expert for GTM, so I guess he has more insights than us).

But GTM does not require jQuery to work (that's sort of the point of having a built-in selector engine), and if you are seeing jQuery-related errors they come from a tag inside GTM that requires jQuery than from GTM itself (or, if you load marketing tags, they might in turn load something else that requires jQuery).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM