Is there any module to add some new things like Google Tag Manager's code to Drupal based website? for example you should install Google analytic module to add analytic to your site, is any equivalent for Google Tag Manager?
You might be interested in:
This module provides a way to serve DoubleClick's Google Publisher Tag (GPT) (Premium and Small Business) ads on Drupal.
Benefits of GPT
The new Google Publisher Tags have multiple benefits over Google Ad Manager (GAM) tags and the legacy DoubleClick for Publishers Dart tags.
- Ad loading does not block the page from rendering, improving page load time. Can be disabled if desired.
- Google Publisher Console
- Accessed by loading a page of your site with ?google_console=1 appended to the URL page and using the keyboard shortcut Ctrl+F10 to toggle the console.
- Single request mode
- The browser sends a single request for retrieving all add units for the page, enabling advanced roadblocking and improving page load time.
- Multiple instances of the same ad unit on a page
- SSL support
- Slot-level custom targeting
- Refreshing ad slots on a page
you should use these two:
First one installs GTM on your page, second one enables passing many variables and taxonomies to be passed to dataLayer. It also has an alter function, if you'd like to add some extra data (since the module is written in a general way and i.e. extracting taxonomies from json arrays on the GTM side can be complicated).
Installing Google tag manager is a bit complex, specially on CMS such as Drupal, here’s a complete tutorial for it at: https://www.cloudways.com/blog/install-google-tag-manager-drupal/ Its very easy to follow I hope others will find it usefull too.