Skip Navigation

[Resuelto] google tag manager integration

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
How to add the code required for Google Tag Manager

Solution:
There are two blocks of code to be added as per the Google Tag Manager documentation, one near the start of the head tag, the other immediately after the opening body tag, which can be done by editing the theme's header.php file.

But the easiest solution is to use a plugin which will do it for you, such as https://wordpress.org/plugins/google-tag-manager/

Relevant Documentation:
https://developers.google.com/tag-manager/quickstart

This support ticket is created hace 6 años, 12 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Etiquetado: 

This topic contains 4 respuestas, has 2 mensajes.

Last updated by christerA hace 6 años, 12 meses.

Assisted by: Nigel.

Autor
Mensajes
#516770

Hi.

I'm trying to install the Google Tag Manager
It says:
"Copy the code below and paste it onto every page of your website. Paste this code as high in the <head> of the page as possible:"

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'hidden link);
})(window,document,'script','dataLayer','GTM-W683MWJ');</script>
<!-- End Google Tag Manager -->

"Additionally, paste this code immediately after the opening <body> tag:"

<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="hidden link"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

Questions:
I use Toolser Starter Theme and Toolset Starter Child (active).
Where exactly do i put the code (2 places, see above)?

I read somewhere i can NOT put it in Layout JS editor, is that right?

And if i put it directly into the header.php in Toolset Starter Theme, it will be overwritten when you update the theme, right?
How do i put it in the child theme? Do i have to copy the header.php and override it?
Or are there any hooks i can use in the functions.php?
Or any plugins?

I really hope you can add the ability to do this in admin in the future (like StudioPress...)

#516846

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

You can copy the file header.php from the parent theme to the child theme folder and then edit it.

On the current version of the theme you would add the first block of code immediately after the opening head tag (line 62), and the second block of code immediately after the opening body tag (currently line 89).

If you are not comfortable doing that there is a plugin which will do it for you, you simply have to add your Google Tag Manager ID in the settings: https://wordpress.org/plugins/google-tag-manager/.

Note that this is a 3rd party plugin, I wouldn't expect you to experience any difficulties with it, but, naturally, that is beyond our control.

#516925

Hi.

I installed the plugin and i think it works, thanks.

This is a completely new question, but if i go into Google Webmaster tools and select the data highlighting tool, i get an error when trying to highlight all blog posts:
"We don'r recommend publishing......We don't understand the pattern of your tags"

Do you knoe if there is a problem with that tool and Toolset. Does it understand custom post types and Layouts? Anything you heard anything about?

#516991

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+01:00)

Hello again

I'm not aware of any problems using Google's Webmaster tools with Toolset-based sites.

If you are encountering problems could you please post a new thread describing the issue with as much detail as possible, including screenshots of where you are trying to use the data highlighter.

Thanks

#517015

I'll check more with Google's Webmaster tools.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.