Linking Optimize to WordPress using GA plugin
-
I’m unable to link Google Optimize to WordPress Account using GA plugin. I followed the below steps for GA Universal Analytics (analytics.js)
Tracking code location: include in wp_head
Custom tracker options: ga(‘require’, ‘OPT-XXXXXXX’);
Custom Code:
<HTML>
<HEAD>
<!– anti-flicker snippet (recommended) –>
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=’ ‘+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(‘ ?’+y),”)};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,’async-hide’,’dataLayer’,4000,
{‘OPT-XXXXXXX’:true});</script>I still see the below error:
We found problems with the Optimize installation on this page
Refer to the diagnostics below to fix problems and troubleshoot any issues with your installation. Learn more about diagnostics .
Errors
Analytics pageview not detected
This page isn’t sending pageview hits to Google Analytics property (UA-XXXXXX-XX) configured for this experiment. You won’t be able to measure usage of your site or monitor performance of Optimize experiments. Make sure that your Analytics tracking code (either analytics.js or gtag.js ) is set up correctly.Suggestions
Optimize not in the HEAD
For best performance, the snippet that loads the Optimize plugin (whether it’s Analytics, Tag Manager, or gtag.js) should be installed in the <HEAD> element of your web page, immediately after the anti-flicker snippet . The Deploy Optimize help center article and tagging best practices section contain more information on the best way to install Optimize.
The topic ‘Linking Optimize to WordPress using GA plugin’ is closed to new replies.