How do I capture product_state using jQuery(this).data

Gold Contributor
Gold Contributor
Hello A,, I am trying to set-up an extensions to track the class=.product-state (inStock) and I have everything configured but Iâ m getting at JS error. Here is the code: *IN STOCK Here is my extension: jQuery select: .product-state Trigger: show Tracking Event: link Set: product_state(js) To: JS Code 'jQuery(this).data('.product-state')'
4 REPLIES 4

How do I capture product_state using jQuery(this).data

Employee Emeritus
Hi Andre, What "JS error" are you receiving?

How do I capture product_state using jQuery(this).data

Gold Contributor
Gold Contributor
Hi Meng, Uncaught Syntax Error: Unexpected String If references this line }catch(e){utag.DB(e)}; try{ if(typeof utag.runonce[144]=='undefined'){utag.runonce[144]=1;jQuery(document.body).on('mouseover','.product-state', function(e){utag.link({ product_state:'jQuery(this).data('.product-state')' })});} }catch(e){utag.DB(e)};}})

How do I capture product_state using jQuery(this).data

Gold Contributor
Gold Contributor
I just removed the quote brackets around product-state 'jQuery(this).data(.product-state)' I'm going to test

How do I capture product_state using jQuery(this).data

Employee Emeritus
It looks like there are single-quotes around your JS Code. Please remove the single-quotes and see if that will work. It would look something like this jQuery(this).data('.product-state') or jQuery(this).data(".product-state")
Public