Highlighted

Site Catalyst Custom Event on Page Load?

Tealium Employee
I need to trigger an event when a specific page loads as opposed to on on-click, hover, mousedown, etc.. and having our developer hard code this is not an option at this point. So I am assuming I can accomplish this through the utag.link call within an extension with something like the following.... utag.link({ variable1: "variable1", variable2: "variable2", link_text: "someLinkText"}); Condition: when page="somepagename". Then map "event1" when link_text = someLinkText What is the best way to accomplish this? Thanks
8 REPLIES 8
Highlighted

Site Catalyst Custom Event on Page Load?

Employee Emeritus
Hello James! I would suggest using a Set Extension with that condition. You can set a flag to the event name "event1" then map event to that flag. Does that make sense? Jon
Highlighted

Site Catalyst Custom Event on Page Load?

Employee Emeritus
Hey James, If you want the event triggered on page load then there isn't a need for utag.link or utag.view since the SiteCatalyst tag will fire automatically on page load. You can trigger the event in one of two ways. 1) Use a variable defined on page load in mappings. Let's say your page ="somepagename" In the Mapping Section for SiteCatalyst select "page" as your variable. Click Select Destination, and in the mapping toolbox, under the "Events" tab, you would type in "somepagename" (without the quotes) and select the event you want to trigger. Now when page equals "somepagename" the selected event will be triggered. 2) Use a Set Data Values extension to trigger the event using u.addEvent. Add a Set Data Values Extension. In the Set: field select sc_events as the variable. You may need to add this as a new data source. Select "JS Code" as the To: selector Then type this in the box: u.addEvent("event##") Add the condition you would like to use like: when page equals "somepagename" Hope this helps.
Highlighted

Site Catalyst Custom Event on Page Load?

Tealium Employee
Jared and Jon - thanks for the input. Jared...your solution worked as I can see my event being called as I was able to before (your method is easier). However, now my issue is that the event related variables to not clear when performing other actions on the page. Let me clarify. We are creating a friendly page name based off a few variables plus an application variable screenName. fname =LFG:Visualizer:Variable Annuity:visualizer main. This page is where I want event10 to trigger as well as an eVar and every other data source that I am setting - this is working just fine based on your logic. If I click on a modal on that same page a new screenName is rendered thus a new page name (LFG:Visualizer:Variable Annuity:Assumptions Disclosures Help Modal) is built. However, I still see my conditional logic being triggered. Could this be the related to the order of my extensions? I have enabled clear vars in my SC Tag which is clearing the event data but it has a negative impact on some of the other variables that I am setting within the app. Thanks
Highlighted

Site Catalyst Custom Event on Page Load?

Employee Emeritus
James, Can you just change the condition of the extension triggering the event to be more granular? Only fire when page EQUALS "somevalue" You can also all an "AND" statement AND page DOES NOT EQUAL "thisvalue" Or you can use the first option and use mappings. In the value box of the events tab put "LFG:Visualizer:Variable Annuity:visualizer main" then in the event will only get triggered when screenName.fname equals that value and it won't fire any other time.
Highlighted

Site Catalyst Custom Event on Page Load?

Tealium Employee
Hey Jared, Thanks for the response. I have tried these methods and the data is still persisting. I think this is due to the fact that the page on which I am calling the event does not reload on subsequent actions -- similar to an AJAX call. So I think I have to force the utag.link call. Can I include the event within the utag.link parameters?
Highlighted

Site Catalyst Custom Event on Page Load?

Tealium Employee

Hey Jared, just dropping an update here. By calling the event when fpname =LFG:Visualizer:Variable Annuity:visualizer main I can successfully see the even being passed and the event is no longer persisting on subsequent screens. However, a number of variables that appear to be in the data object no longer send. They only send on the first page load for the application and then decay as I traverse through the app. These variables are noted below by the prefix js_page and were added through the web companion. Any thoughts? Our assumption is that if we can see them being populated in utag.data then they should be passed. utag.data: Object cp.BIGipServervisualizer2-dev_pool: "1865629706.30759.0000" cp.s_cc: "true" cp.s_fid: "1DAF474355FD1C84-09E248117454E758" cp.s_pers: " s_vnum=1413403640030%26vn%3D1|1413403640030; s_fid=6CBD92B2FF7F5025-34DABAC3FBC9893E|1444940548977; s_invisit=true|1381870348985;" cp.s_sess: " s_cc=true; s_sq=lfgmobilevizdevjs%3D%2526pid%253DLFG%25253AVisualizer%25253AVariable%252520Annuity%25253Aintroduction%252520modal%2526pidt%253D1%2526oid%253Djavascript%25253A%25253B%2526ot%253DA;" cp.s_vi: "[CS]v1|292ED03C051D3A52-4000012D60086241[CE]" cp.utag_dslv_1381868549008: "undefined" cp.utag_dslv_s_Less than 1 day: "undefined" cp.utag_invisit_true: "undefined" cp.utag_main__st: "1381870353711" cp.utag_main_ses_id: "1381868286254" cp.utag_vnum_1384459640066&vn=1: "undefined" dom.domain: "visualizer2-dev.lfg.com" dom.pathname: "/visualizer2/visualizer/index.jsf" dom.query_string: "companyCode=10001&userType=non-lincoln" dom.referrer: "" dom.title: "Annuity Visualizer" dom.url: "https://visualizer2-dev.lfg.com/visualizer2/visualizer/index.jsf?companyCode=10001&userType=non-linc..." fname: "LFG:Visualizer:Variable Annuity" js_page.ENV: "dev" js_page.appConfig.applicationType: "web" js_page.appConfig.chartType: "income" js_page.appConfig.headerTitle: "Variable Annuity Visualizer" js_page.appConfig.productName: "al" js_page.appConfig.userType: "non-lincoln" js_page.buildNumber: "0105" js_page.tealiumURL: "//tags.tiqcdn.com/utag/lfg/webvis/dev/utag.js" l1: "LFG" l2: "Visualizer" lob: "Variable Annuity" meta.apple-mobile-web-app-capable: "yes" meta.description: "" meta.viewport: "width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" qp.companycode: "10001" qp.usertype: "non-lincoln" testVariable: undefined visType: "Web" __proto__: Object

Highlighted

Site Catalyst Custom Event on Page Load?

Employee Emeritus
Hey James, Your assumptions are correct given that the mappings are in place for these js_page variables. The events update that was suggested above should not have affected any of your other variables or mappings so it seems like something else has changed. This is getting really specific to your use case. It would best be handled by reaching out to your Account Manager and one of our Solutions Engineers can take a look at your profile and provide greater insight.
Highlighted

Site Catalyst Custom Event on Page Load?

Tealium Employee
Thanks Jared!