• Resolved davidmonnuar

    (@davidmonnuar)


    Hello,

    I’m using Cookiebot WordPress Plugin and I’d like to implement Google Optimize in my GTM container to perform an A/B test. In order to avoid page flickering, Google Optimize suggests to insert a fix script reported at this documentation before the Google Tag Manager script.

    I know that Cookiebot script should be at the top of the HTML header however it looks like that even if the Google Optimize Anti-flickering script is set before wp_head() in header.php Cookiebot is still able to push my script after the ones handled by Cookiebot.

    Could you please let me know If I’ve missed something?

    Here is my plugin configuration

    WordPress Version: 5.7.5
    WordPress Language: it-IT
    PHP Version: 7.4.27
    MySQL Version: 5.6.51
    
    --- Cookiebot Information ---
    Plugin Version: 4.0.2
    Cookiebot ID: XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX // I've removed it for privacy
    Blocking mode: auto
    Language: it
    IAB: Not enabled
    CCPA banner for visitors from California: Not enabled
    CCPA domain group id: 
    Add async/defer to banner tag: None
    Add async/defer to declaration tag: async
    Auto update: Not enabled
    Hide Cookie Popup: No
    Disable Cookiebot in WP Admin: Yes
    Enable Cookiebot on front end while logged in: No
    Banner tag: <script type="text/javascript"
    		id="Cookiebot"
    		src="https://consent.cookiebot.com/uc.js"
    		data-cbid="XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX"
    								data-layer-name="dataLayer"
    						data-culture="IT"
    				data-blockingmode="auto"
    	></script>
    
    Declaration tag: <script
    		type="text/javascript"
    		id="CookieDeclaration"
    		src="https://consent.cookiebot.com/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX/cd.js"
    					data-culture="IT"
    				async></script>
    
    GTM tag: <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-XXXXXX'
    	);
    </script>
    
    GCM tag: <script data-cookieconsent="ignore">
    	(function(w,d,l){w[l]=w[l]||[];function gtag(){w[l].push(arguments)}
    	gtag("consent","default",{ad_storage:d,analytics_storage:d,wait_for_update:500,});
    	gtag("set", "ads_data_redaction", true);})(window,"denied","dataLayer");
    </script>
    
    --- Activated Cookiebot Addons ---
    Embed autocorrect (statistics, marketing)
    • This topic was modified 3 years, 1 month ago by davidmonnuar.
    • This topic was modified 3 years, 1 month ago by davidmonnuar.
    • This topic was modified 3 years, 1 month ago by davidmonnuar.
Viewing 1 replies (of 1 total)
  • Plugin Author aytac

    (@aytac)

    Hello @davidmonnuar

    You’ll need to define the priority of the hook call to place the code before the GTM code.

    I was able to implement the code before the GTM script by adding this line to functions.php of my theme.

    add_action('wp_head', 'include_flicker_script', -9998)

    Does this help you?

    Take care,

    Aytac

Viewing 1 replies (of 1 total)
  • The topic ‘Cookiebot – Google Optimize Anti-flickering’ is closed to new replies.