0

I know how to create child theme for wordpress theme but having problem in installing Google Tag Manager into the child theme. Normally there are two files in the child theme directory (one is stylesheet css and another one is function.php) however, Google suggests to put the identification code into the header.php file, so in this case is there any way to put the identification code of Google Tag manager into the child theme.

2 Answers 2

1

You have a couple of options -

  1. Install a plugin that adds GTM for you. This makes it very easy, but it does add another plugin to the site. Site Kit supposedly slows down a site more than you would expect.

  2. Make a copy of header.php and put it in your child theme folder. Now you can make edits to this file without the edits being overwritten when the parent theme is updated. That's how the child theme works. Anything you want to edit gets copied into the child theme. By default you only get the stylesheet and functions.php, but you can put any theme file into the child theme for editing.

0

You can install a plugin for adding the tag. Google's official Site Kit or WP Global Site Tag by Digital Apps could help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.