- This topic has 3 replies, 3 voices, and was last updated 5 years, 4 months ago by
David.
-
AuthorPosts
-
December 4, 2020 at 1:43 am #1566892
Ivan
Hi,
In En Appearance -> Elements -> Legacy Hooks -> wp_head
Would it be okay to paste the Google Analytics code?
I say this because there is the meta data that is html and the Google Analytics code is a script
If I paste it there, the whole web will take it, right?
thanks,<head>
<title>EMCO LIMPIEZAS</title>
<meta name=”Inicio” content=”Servicios profesionales de limpieza en Valencia España”>
<meta name=”Empresa” content=”Información sobre la empresa”>
<meta name=”Servicios” content=”EMCO, Servicios de Limpieza, Limpieza de Comunidades, Limpieza de Oficinas, Limpieza de Despachos, Limpieza de Comercios, Limpieza de Cristales, Limpieza de Garajes, Vitrificado y Abrillantado, Limpieza Fin de Obra”>
<meta name=”Contacto” content=”Datos de Contacto”>// Codigo Google Analytics
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=G-0WFG04H5CP”></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘G-0WFG04H5CP’);
</script>
// FIN Codigo Google Analytics</head>
December 4, 2020 at 2:28 am #1566939Elvin
StaffCustomer SupportHi,
To clarify: You’re trying to hook your google analytics code to your
wp_head?If so, then Appearance -> Elements -> Hook element is definitely a good way to add it in.
https://docs.generatepress.com/article/hooks-element-overview/But be specific, you will only need this to add in to the Hook element:
// Codigo Google Analytics <!– Global site tag (gtag.js) – Google Analytics –> <script async src=”https://www.googletagmanager.com/gtag/js?id=G-0WFG04H5CP”></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘G-0WFG04H5CP’); </script> // FIN Codigo Google AnalyticsAnd perhaps you can add the meta tags as well if its not already automatically added in.
To shed more light on this matter:
You don’t need to add
<head>..</head>&<title>...</title>as it already exist andwp_headis basically the hook we use to place within the existing<head>tag of the page.Title tag is automatically generated by WordPress when you created the page, the text string inside it is taken from the title you set when you created the page.
December 4, 2020 at 2:46 am #1566962Ivan
Hi Elvin, “You’re trying to hook your google analytics code to your wp_head?” -> yes i’m trying to connect google analytics code with wp_head.
So what I have done I understand that it is good?
I have deleted the <head> from wp_head.
Gracias,December 4, 2020 at 9:47 am #1567601David
StaffCustomer SupportHi there,
yes that is good 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.