- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
09-20-2013 06:49 AM
09-20-2013 06:57 AM
09-20-2013 07:08 AM
09-20-2013 07:08 AM
09-20-2013 07:11 AM
09-20-2013 07:19 AM - last edited on 10-06-2015 10:13 PM by akshata_yerdoor
this is a product quick view page (modal page), i want to fire a page view tag on load of quick view modal page.
should i use the below script or above method - (<> no added with script)
script
utag.view ({
brand:"abc",
category_id: "asdf",
event_type: "conversion"
/script
script
tealium script (utag.js file)
})();
/script
when i am using the above script it is showing utag is not defined.
09-20-2013 07:33 AM
09-20-2013 07:46 AM - last edited on 10-06-2015 10:16 PM by akshata_yerdoor
You would need to make sure that Tealium is higher up on the page than your script tag. Utag only gets defined inside utag.js, so if your script is running before Tealium, this won't work.
It would also be sensible to check if utag is defined before trying to call it. If not, you could use setTimeout to wait until utag is defined on the page. Something like:
--script--
(tealium utag.js)
--/script--
--script--
window.callTealiumView = function(){
if (typeof utag !=="undefined" && typeof utag.view==="function"){
utag.view({
"brand":"abc",
"category_id":"askjdasd",
"event_type":"conversion"
});
} else {
window.setTimeout(callTealiumView, 300);
}
}
--/script--
--script -- window.callTealiumView();//initiate the function --/script--
This will keep attempting to call utag.view until it exists on the page. The code above is not production ready!!! I only mocked it up quickly to demonstrate a possible solution. Please don't use it without reviewing it first.
Copyright All Rights Reserved © 2008-2023