Reply
Highlighted
Visitor
Posts: 10
Registered: ‎09-22-2015

How to suppress events on page load and have them fired only when the button is clicked?

Hi,

Is there a javascript that we can use to suppress event call on page load?

The below extension is not working for me -

try{

  if(b._utag_event === 'link' && typeof b.EventType !== 'undefined' && (b.EventType === 'TipExpand’ || b.EventType === 'NutritionExpand’) ){

    return false;

  }

}

catch(e){

  utag.DB(e);

};

Regards,

Pallavi

Reply
0 Kudos
Visitor
Posts: 1
Registered: ‎01-29-2018

Re: How to suppress events on page load and have them fired only when the button is clicked?

Are you sure it's not utag.view() or maybe utag.link() you want to run this code through?  As far I know the b Object is only a copy and is not global. It also sounds like you want to impact an action post page load. According to the b Object documentation:

"...on subsequent tracking calls that occur after the page load, the b object is a copy of the object passed to utag.view() or utag.link() and does not contain variables from the origial on-page data object. However, you can preserve data from utag_data in tracking calls (per page load) by using the Base Variables setting in the publish settings..."

https://community.tealiumiq.com/t5/JavaScript-utag-js/The-b-Object/ta-p/13620

Hope that helps.

Reply
0 Kudos
Occasional Contributor
Posts: 60
Registered: ‎04-20-2016

Re: How to suppress events on page load and have them fired only when the button is clicked?

Hi

You can use the a object for this.

The a object is the type of event, and is a string set to either "link" or "view".

We have quite a lot of JS extensions that open with 

if( a === "link" ) { ... }

or

if( a === "view" ) { ... }
Reply
0 Kudos