How not to use jquery with google tag manager?

by priscilla.langworth , in category: SEO Tools , 4 months ago

How not to use jquery with google tag manager?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

Member

by drew , 4 months ago

@priscilla.langworth 

To not use jQuery with Google Tag Manager, you can follow these steps:

  1. Remove any existing jQuery library loading code from your website or templates. This can be typically found in the tag or just before the closing tag.
  2. Disable or remove any scripts or tags in Google Tag Manager that rely on jQuery. This can include custom HTML tags, custom JavaScript variables, or custom templates that use jQuery.
  3. Review and update any existing JavaScript code that relies on jQuery and modify it to use plain JavaScript instead. Replace jQuery methods and functions with their equivalent native JavaScript equivalents. For example, use document.querySelector() instead of $("selector").
  4. Test your website thoroughly to ensure that it functions as expected without jQuery. Check for any errors or issues in the browser console and fix them accordingly.
  5. Once your website is confirmed to be working without jQuery, republish or update your Google Tag Manager container to reflect the changes.


By following these steps, you can remove the dependency on jQuery and use plain JavaScript instead in conjunction with Google Tag Manager.