Expand my Community achievements bar.

SOLVED

Anti-flicker

Avatar

Level 3

Hi,

 

I have the pre-hiding code snippet sitting above my tag manager in the head.

 

In the tag manager (GTM) I am triggering AT.js. 

 

Should I be removing the default pre-hiding code from the Target javascript file if I am running it prior to the tag manager?

 

If so, what is the best way of removing it? 

 

Thanks

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You only need the pre-hiding snippet if Target is loaded asynchronously. It is asynchronous via the GTM.

However, here you still have to consider which rules are created in GTM to load Target. If there are rules or conditions that control whether the target should be loaded at all (e.g. Consent etc.) - this is important to know.

 

An elegant method is - to write a kind of wrapper code around the pre-hiding snippet - which checks the same condition if Target should be loaded at all. Classic example is if Consent is present or not. So in case Target is not loaded intitially - the pre-hiding snippet will not be executed.

 

If Target should be loaded - then Target itself removes the pre-hiding via at.js.

View solution in original post

5 Replies

Avatar

Employee Advisor

Hi @nicholase927171 

 

I am assuming that by AT JavaScript file you mean at.js. I would recommend not removing any code from AT JavaScript file. 

Avatar

Community Advisor

I agree with @Gaureshk_Kodag. I wouldn't change anything in at.js itself. That doesn't make much sense because you don't want to change the code every time you update the at.js because there is a new version. Besides, the logic in the at.js is correct and works even if the interaction with the pre-hidings snippet is correct. It is important to mention that the pre-hidings snippet is executed as early as possible in the head.

Avatar

Correct answer by
Community Advisor

You only need the pre-hiding snippet if Target is loaded asynchronously. It is asynchronous via the GTM.

However, here you still have to consider which rules are created in GTM to load Target. If there are rules or conditions that control whether the target should be loaded at all (e.g. Consent etc.) - this is important to know.

 

An elegant method is - to write a kind of wrapper code around the pre-hiding snippet - which checks the same condition if Target should be loaded at all. Classic example is if Consent is present or not. So in case Target is not loaded intitially - the pre-hiding snippet will not be executed.

 

If Target should be loaded - then Target itself removes the pre-hiding via at.js.

Avatar

Level 3

Thanks for the reply.  My concern was that the pre-hiding snippet is placed twice. Once above AT.js but also within the Target script itself. Sounds like that isn't an issue...

Avatar

Community Advisor

Yes the at.js is powerful in itself and can also cover e.g. a SPA accordingly and also holds an own pre-hiding in itself which can also be influenced via e.g. the targetGlobalSettings() function. But this should not bother you.

 

But do you have flickering problems in general?