1.7K members online now
1.7K members online now
Everything you need to know about setting up Optimize including creating your account and container, linking to Google Analytics and how to tag your site.
Guide Me
star_border
Reply
Highlighted

Page hiding snippet - unhide delay issue (Optimize deployed via GTM)

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I had already submitted this post like half an hour ago, and suddenly it vanished... luckily I could still find the text, so I'm posting it again now.

No idea how that happened... didn't get a notification or anything, the old post is just gone. Anyway... here goes:

 

Hello,

I'm having trouble setting up an Optimize A/B test, and the issue apparently lies in the page hiding snippet.
I've followed the instructions here: https://support.google.com/360suite/optimize/answer/6314801

Optimize is fired via GTM, and I've inserted the page hiding snippet directly in our page template in the <head>.
Then I've set up a basic A/B test, to check the functionality.

The test itself works fine, but my problem now is: The page won't "unhide" until the delay specified in the page hiding snippet is passed (default 4000 ms). For testing purposes I raised the delay to 10 seconds just to make sure it's not just an issue of slow loading... Result is, the page is "unhidden" after full 10 seconds.

Obviously the page should unhide as soon as the GTM/Optimize Containers are loaded, and not after x milliseconds ...
Any ideas where I might start looking to fix this?


Note: I'm currently using the Preview Mode of Google Tag Manager to test the Optimize integration. Could this cause the problem?
(Unfortunately, it's the only option I have right now. But since I don't have a dedicated testing environment in GTM yet, I have to use the Preview Mode for testing...)

EDIT: I now set up a testing environment in GTM, and the problem persists. So it's not related to the preview mode. /EDIT

Any help appreciated!

Best regards,
Matthias

 

Page hiding snippet - unhide delay issue (Optimize deployed via GTM)

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

My post seems to have vanished as well... any ideas why it happened?

Page hiding snippet - unhide delay issue (Optimize deployed via GTM)

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Sorry, no idea.

Marked as Best Answer.
Solution
Accepted by topic author Matthias B
1w

Re: Page hiding snippet - unhide delay issue (Optimize deployed via GTM)

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Found the error ... It was a surprisingly simple and - dare I say - stupid mistake from our side Smiley Very Happy Smiley Very Happy Smiley Very Happy

 

 

For some reason in our implementation of the Google Tag Manager, the dataLayer was initialized like this: 

 

dataLayer = [];

 

 

Instead of the usual:

 

dataLayer = window.dataLayer || [];

 

 

That means after the page-hiding snippet was executed but before the GTM container was loaded, the dataLayer was reset.

Since the page hiding snippet uses the dataLayer to "submit" the unhide function to GTM, of course it couldn't work properly.

 

I have no idea why this was the case but it's fixed now and everything works.