0

I would like to setup Google Analytics event tags based on the jQuery onHandler. I would like to use a lookup table with the jQuery as the key and push the GA event parameters as the value. Only issue is that I don't know how to set the jQuery as the lookup value.

Any suggestions?

ericbrownaustin
  • 1,230
  • 4
  • 18
  • 36

1 Answers1

1

If you are using Tealium then the way this would be done is with two extensions. The first one would set a new variable to the value obtained with jQuery, the second one would be the lookup table that would utilize the same variable in the "Lookup Value In" field. If both extensions are scoped the same then the jQuery extension will need to be placed above the lookup table so it will run first.

Here is an example of the two extensions you could set up:

This first one sets a new variable (new_var) to a value when you mousedown on the selected element. This can be changed to however you want to populate your data. jQuery Extension setting new_var to a value

This next extension is the lookup table where your lookup value is the new_var that you just populated, and the destination is the variable that you will map into your tag. Lookup Table extension

klasp
  • 11
  • 2
  • I would like to do exactly as you've mentioned, but I don't know how to push a jQuery onHandler to a variable. The jQuery onHandler is not an option for the lookup table key. That is the one piece I am missing. – ericbrownaustin May 21 '20 at 14:43
  • I just updated the post with some clarifications and screenshots. Let me know if this makes it more clear. – klasp May 22 '20 at 15:31
  • Would the extension you've shown apply to all links or only a specific link with a jQuery id of ".btn"? – ericbrownaustin May 27 '20 at 14:39
  • What that extension does is fire a utag.link() call whenever a mousedown event occurs on an element that matches the jQuery selector. The selector is ".btn" the period indicates that you are looking for a class with the name "btn". There is lots of information online on how to create the appropriate selector. https://api.jquery.com/category/selectors/ – klasp May 28 '20 at 15:14
  • If you want a selector for all links it should just be "a" This will work for every element – klasp May 28 '20 at 15:17