Using set data value extension to capture url on click, possible?

Silver Contributor
Silver Contributor
I have a Floodlight tag where I am trying to pass the along the URL that is clicked with the tag. Can I use the 'set data value' extension to do this with JS Code? Example: I have a tag tracking certain links on the page. With the tag I want to pass along the URL path that is clicked on. Code example: Click me. In this example I'd pass along in the tag u4=www.example.com/doc/blah/pdf. I assume this is possible via the set data value extension but I don't know JS code that well. Thoughts or ideas?
1 REPLY 1

Using set data value extension to capture url on click, possible?

Employee Emeritus

Hi Dustin,

 

The only way you'd be able to grab this really would be to ensure that the utag.link() event which passes in data to Tealium has already grabbed the href (or the whole element) so that you can use an extension to pick the part you want. e.g. if your jQuery looked like this:

 

jQuery(document.body).on('mousedown','a[href="www.example.com/doc/blah.pdf"]',function(e){ utag.link({ event_name:"click on button", link_object:this, link_url:e.this.href }); );

 

You could refer to the href as either the 'link_url' data source (i.e. b.link_url) or you could refer to 'b.link_object.url' in a set data values extension (with type 'JS code'). If you don't pass in the href or the itself then there's no way of really grabbing it once you're in Tealium without masses of probably unreliable code (if at all).

 

Cheers, Roshan

Public