- This topic has 5 replies, 2 voices, and was last updated 7 years, 9 months ago by
Leo.
-
AuthorPosts
-
January 8, 2018 at 7:46 am #465888
Louis
I just got a google analytics account and was give the following code below. A couple of questions please:
1. I do not see <HEAD> on any of the pages. Am I missing something?
2. Is there an easier way to use this code? Header? Footer? Widget? CSS?
3. Do I have a Global Site TagThanks.
Global Site Tag (gtag.js)
This is the Global Site Tag (gtag.js) tracking code for this property. Copy and paste this code as the first item into the <HEAD> of every web page that you want to track. If you already have a Global Site Tag on your page, simply add the config line from the snippet below to your existing Global Site Tag.<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-112123355-1″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘UA-112123355-1’);
</script>January 8, 2018 at 9:47 am #465995Leo
StaffCustomer SupportHi there,
Check this out: https://docs.generatepress.com/article/wp-head/
January 8, 2018 at 2:17 pm #466196Louis
Thank you. I found it. Should I replace this one?:
<!– 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=
‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-538XZ3Q’);</script>
<!– End Google Tag Manager –>With this one from Google?:
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-112123355-1″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘UA-112123355-1’);
</script>January 8, 2018 at 2:23 pm #466200Leo
StaffCustomer SupportI believe they are separate code.
See this: https://generatepress.com/forums/topic/google-tag-manager/
January 9, 2018 at 6:58 am #466690Louis
This is the response I received from someone at stackexchage – Lines have been deleted. what do you think?:
<!– 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= ‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f); })(window,document,’script’,’dataLayer’,’GTM-538XZ3Q’);</script> <!– End Google Tag Manager –>
From my Google Analytics account:
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-112123355-1″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘UA-112123355-1’);
</script>January 9, 2018 at 7:16 am #466710Leo
StaffCustomer SupportI’m not sure what you mean?
Google should’ve provided the specific instruction along with the code.
-
AuthorPosts
- You must be logged in to reply to this topic.