- This topic has 11 replies, 3 voices, and was last updated 3 years, 12 months ago by
David.
-
AuthorPosts
-
June 5, 2019 at 10:44 pm #921228
takkularapsis
Hi,
My Google marketing provider sent me this script to be added in the head-section of the page. After i have added the code i tryid to check and still conversion alantyics isnt active…?
<!– Global site tag (gtag.js) – Google Ads: 749550544 –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=AW-749550544″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘AW-749550544’);
</script>I have added this to hooks -> wp-head ( execute php and priority set to 0 )
June 6, 2019 at 2:15 am #921324Anders Nielsen
Do you use the correct google Analytics code?
Both of them needs to be installed for the optimize plugin to work
June 6, 2019 at 2:29 am #921337takkularapsis
Hi,
I have installed google analytics via google and monsterinsights. Should i do something else?
Heres what reads in source code:var disableStr = ‘ga-disable-UA-126725762-4’;
/* Function to detect opted out users */
function __gaTrackerIsOptedOut() {
return document.cookie.indexOf(disableStr + ‘=true’) > -1;
}/* Disable tracking if the opt-out cookie exists. */
if ( __gaTrackerIsOptedOut() ) {
window[disableStr] = true;
}/* Opt-out function */
function __gaTrackerOptout() {
document.cookie = disableStr + ‘=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/’;
window[disableStr] = true;
}if ( mi_track_user ) {
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’__gaTracker’);__gaTracker(‘create’, ‘UA-126725762-4’, ‘auto’);
__gaTracker(‘set’, ‘forceSSL’, true);
__gaTracker(‘send’,’pageview’);
} else {
console.log( “Note: The site owner has disabled Google Analytics tracking for your user role.” );
(function() {
/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */
var noopfn = function() {
return null;
};
var noopnullfn = function() {
return null;
};
var Tracker = function() {
return null;
};
var p = Tracker.prototype;
p.get = noopfn;
p.set = noopfn;
p.send = noopfn;
var __gaTracker = function() {
var len = arguments.length;
if ( len === 0 ) {
return;
}
var f = arguments[len-1];
if ( typeof f !== ‘object’ || f === null || typeof f.hitCallback !== ‘function’ ) {
console.log( ‘Not running function __gaTracker(‘ + arguments[0] + ” ….) because you are not being tracked. ” + mi_no_track_reason );
return;
}
try {
f.hitCallback();
} catch (ex) {}
};
__gaTracker.create = function() {
return new Tracker();
};
__gaTracker.getByName = noopnullfn;
__gaTracker.getAll = function() {
return [];
};
__gaTracker.remove = noopfn;
window[‘__gaTracker’] = __gaTracker;
})();
}
</script>June 6, 2019 at 5:02 am #921456David
StaffCustomer SupportHi there,
if you use the browser tools > inspect you should be able to see your scripts in the Head of the document. Which means the hook is working, can you confirm that the correct tags are being used.
June 6, 2019 at 5:25 am #921473takkularapsis
June 6, 2019 at 6:22 am #921518David
StaffCustomer SupportIf you can see it then yes the hook is working. Can you also see the Google Analytics script from Monster Insights?
June 6, 2019 at 6:58 am #921683takkularapsis
Cant see it in monster insight. Maybe it is because dont have pro version of it…? But i count that it is working 🙂
June 6, 2019 at 7:06 am #921687David
StaffCustomer SupportIf you’re google analytics code is working, which i assume you can tell from your google analytics account then there must be something wrong with the other script you have been provided with.
June 6, 2019 at 7:14 am #921701takkularapsis
I dont have any other scripts or other analytics than monster insights connected with GA. This is the script they provided me. when i put this to wp_head hook, and check with gachecker it shows global tag ok, and if i remove it and check again, it shows not ok. This is my first time adding the code to GP so there could be issue with the user here 🙂
<!– Global site tag (gtag.js) – Google Ads: 749550544 –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=AW-749550544″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘AW-749550544’);
</script>June 6, 2019 at 3:57 pm #922148David
StaffCustomer SupportThe code looks fine to me and is showing in the head of the document, and if the GAChecker says its ok then i can’ see what the problem is.
June 7, 2019 at 3:44 am #922457takkularapsis
Thank you for support!
June 7, 2019 at 3:50 am #922462David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.