Conditional utag.link firing

Gold Contributor
Gold Contributor

Hi,

I would like to fire an utag.link only when a checkbox is checked and a button is clicked.

 

I think a possible solution is to use an internal udo variable setting it to 1 only when the checkbox is selected and then using this condition when the button is clicked.

 

 

How I can do this?

Any suggestions?

 

Many thanks

 

3 REPLIES 3

Conditional utag.link firing

Tealium Employee

Hi, 

 

I'm assuming you've got jQuery on the page, and can therefore use a jQuery onHandler extension to get the button press event. 

 

If that's the case, I'd do something like this - a jQuery onHandler extension, with some custom javascript that also checks the status of the check box, so you don't need to also set it in the data layer.   The data I'm sending to utag.link is just an example of a basic Google Analytics event, but obviously you can add in whatever data you want. 

 

Custom jQuery onHandler event

Connecting data systems since the 1980s.

Conditional utag.link firing

Employee Emeritus

@stefano75,

 

You can use a jQuery handler and select "custom" in the tracking event drop down:

 

Tealium Management Console 2016-05-10 08-34-45.png

 

 

Or, you can use a JavaScript extension like so:

 Tealium Management Console 2016-05-10 08-33-18.png

Conditional utag.link firing

Gold Contributor
Gold Contributor
Thanks a lot.

With the event on the checkbox I populate a utag.data element like utag.data["operatore"] setting this to 1 only if the checkebox is checked and then on the submit event I'm firing the utag.link only if the utag.data["operatore"] is equal to 1.

Public