- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Solved! Go to Solution.
08-14-2014 07:30 AM
08-14-2014 08:21 AM
08-14-2014 08:24 AM
01-29-2019 06:48 AM
@jared_hislop wrote:
The utag.view function will re-evaluate load rules and load in tags that didn't load on page load.[...]
Hi Jared,
just few years late it seems. I don't understand the quoted statement. I have a tag - all pages that's loaded on page load. When i call utag.view() due to cookie-privacy law acceptance, this tag is also reloaded. There's a way to run it once?
I found only ways to run once the utag.view or to just launch/reload a specific tag, but not a all-but-one tag solution.
Thanks
01-29-2019 07:46 AM
Luca
The qoute 'The utag.view function will re-evaluate load rules and load in tags that didn't load on page load.[...]' is saying that a tags whose 'load rule' did not resolve true on the first page load, if a subsiquesnt utag.view has a UDO value that meets the condition of the this tag's load rule, then it will load. ( along with any other tag whose's load rule resolves true ) If a tag's load rule is 'load on all pages then it will send on *any* utag.view since utag.view is considered an event for a synthetic page load.
If you want to only load a tag on on the actual hard loading of a page, then one way would be to scope a javascript extension that creates a window object or variable. Then use this object in the condition that 'if not defined'. Then the tag will load the first time, create the window object, then any other utag.view it would be stopped since the variable is defined and created on the first page load. The javascript window object or variable will be cleared on any hard page load and the tag will only load on actual page-loads and not on single page app page changes and subsiquent utag.views.
Hope this helps.
Robert
01-29-2019 07:56 AM
01-29-2019 09:28 AM - edited 01-29-2019 09:29 AM
luca
Correct, only preloader or extensions scoped to 'all tags' with 'before load rules' checked run before load rule are evaluated.
Extension scoped to a tag setting UDO variable will only persist in the 'b' object ( a copy for the UDO for that tag is passed in as a parameter in the scoped extensions ) and will not be in the utag_data window object at the end of the loading of the tag and running of scoped extension. Of course there are other ways to handle instead of a window object/flag but this way comes to mind first.
Also, instead of using a Generic tag to load a script - you can coordinate a custom container temaplate to only load the script on the first page load and not use the u.send part of the template ( u.send is what is going to be triggered on the 'next utag.view' ) not all the template code runs on both the page load's automatic page view then compared to the second utag.view call. This may be advanced and you should probably consider running this through a support ticket for help if it's your first time coding a custom container. ( having an engineer with experience running you through the code or providing a sample template may prove invaluable. )
Robert
01-29-2019 09:36 AM
Copyright All Rights Reserved © 2008-2023