How to use Google Tag Manager with Wptouch

The Google Tag Manager – GTM – code needs to be just after the opening tag. Other placements will usually work but is not recommended by Google.

If you are using CloudFlare then using DuracellTomi’s Google Tag Manager for WordPress is recommended. Since version 1.3 there is no conflict with GTM when using this plugin.

Child theme

Using a WPtouch Pro child theme should allow you to add the GTM tag to the mobile theme. The child theme will prevent the changes from being overwritten in an event of a plugin and theme update.

Create the child theme manually or by using the Make Child Theme extension.

Manual created child theme

Copy the header.php template from the parent WPtouch Pro theme (/wp-content/wptouch-data/themes) to /wp-content/wptouch-data/themes/yourchildtheme/ and add the code to the bottom of the file.

Make child theme extension

Create a child theme.
Then choose header.php in -Setting- Make Child Theme – Edit Template -.

Add the line:

< ?php if ( functionexists( 'gtm4wpthegtmtag' ) ) { gtm4wpthegtm_tag(); } ?>

to the bottom of the page. Then chose – Save and Close -.

This should do the trick.