Install Google Tag Manager in WordPress

Last updated on August 19, 2021, 11:14 AM

A tutorial how you can quickly install the Google Tag Manager in WordPress

As so often in WordPress there are 2 variants. The manual variant where you have to attack and change certain WordPress files, and the “plugin method” to install the Google Tag Manager in WordPress. The advantages of the Google Tag Manager (GTM) have already been briefly explained here, and since there are actually only advantages, you should also use this wonderful tool :)

The plugin method to install the GTM in WordPress

Here is a sore plugin called Duracell Tomi’s Google Tag Manager for WordPress that pretty much does all the work for you. Using this plugin you actually only need 3 steps:

  1. Find and install the plugin
  2. Activate the plugin in the plugin menu of WordPress.
  3. In the settings click on “Google Tag Manager” and enter the Google Tag Manager Container ID (which you have to copy in the Tag Manager interface before).
  4. google tag manager in wordpress installieren - freshestweb Online Marketing Agenturgoogle tag manager id eingeben in duracell tomis plugin wordpress - freshestweb

The manual method to install Google Tag Manager in WordPress by modifying the header.php file

If you are not afraid to tamper a bit with the header.php files of your theme then I recommend this method, because it saves you again a plugin. The disadvantage here is that you have to repeat this change when you change the theme. First you have to get the install code from the Tag Manager and copy it to a file or the clipboard.

You can find the install code in the GTM here:

GTM install code finden - freshestweb

und dann

GTM google tag manager install code - freshestweb

There you take the code for the header and body area. This must then be inserted into the header.php file using the editor (Design -> Editor). It is best to save a version of the header.php before you make the changes. If you are sure about this I would recommend this method. If not, the security variant is probably the plugin method with the Duracell Tomi plugin :).

And in the next blog post I will continue with the topic: Useful features of Google Tag Manager and how to set them up. (coming soon).  If you sign up for the newsletter, you won’t “miss” any new blog post either.