Google optimize Setup using Google Tag Manager Issue “Analytics configuration mismatch”

Standard

“Analytics configuration mismatch for Google Optimize”

Are you facing issue of Analytics configuration mismatch for Google Optimize using Google Tag Manager 

Recently one client asks me to set up Google Optimize using Google Tag Manager, He said, his development and Google Analytic person tried but did not any success for error “analytics configuration mismatch” continuous facing this because of that he is not able run A/B testing from Google Optimize.

Start looking his setup found a couple of mistakes made by his team, I asked them to give access of websites, Google Tag Manager and Google Optimize access to, rectify mistake apply on “Analytics configuration mismatch for Google Optimize”, If you will search on Google for “Analytics configuration mismatch” So many people are asking this issue, But does not have provided any solution by any other, But it’s tricky to setup Google Optimize using Google Tag Manager

Install Google Tag Manager on Google Tag Manager Code on the website to work Google Optimize

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=
‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-XXXX’);</script>
<!– End Google Tag Manager –>
Additionally, paste this code immediately after the opening <body> tag:
<!– Google Tag Manager (noscript) –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXX”
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –>

Note: Make you will replace GTM Tracking Code with your GTM ID XXXXX

Copy the full code below and Put Googel Optimize as early in the <HEAD> as possible 

<!-- 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_CONTAINER_ID':true});</script>

Note: Make you will replace GTM Tracking Code with your GTM ID (OPT_CONTAINER_ID) XXXXX

Other changes are made in Google Tag Manager and corrected issue for Google Optimize to correct work on it,  Now it’s time very Google Optimize implemented through Google Tag Manager, 

Analytics configuration mismatch & Anti-flicker snippet timed out

DataLayer variable in anti-flicker snippet reassigned

Anti-flicker snippet timed out

Analytics configuration mismatch & Anti-flicker snippet timed out

Warning:if you do n’t know about javascript or do n’t have developing knowledge then do n’t try to Google Optimize using Google Tag Manager a custom javascript without using Any plugin that can broke your site, Cart and other functionality 

Disclaimer: Google tag manager belongs to Google property 

For Contact: mappchero@gmail.com

I am available for Hire on Freelancer: Freelancer.com

I am available for Hire on Upwork: Upwork.com

I am available for Hire on Peopleperhour: Peopleperhour.com

I am available for Hire on Guru: Guru.com