Expand my Community achievements bar.

DTM data elements - add 'this' context support

Avatar

Level 9

10/1/16

Let's say I have the following:

 

 

I make an event based rule, Event Type "click", with an Element Tag or Selector "#foo".  

 

I want to get the text from the button "some text" and pop e.g. eVar1 with that text. 

 

Right now, in order to do this, I have to create a custom condition where I do something like this:

 

 

_satellite.setVar('buttonText',this.innerText); return true;

 

 

And now I can use %buttonText% in my eVar1 field. 

 

This is *okay*, except I do not like this from a maintenance perspective.  I have an on-the-fly data element created within the rule, and the only way anybody will ever know about it is if they go to the rule and look.  

 

What I ask for is the ability to create the data element from the Rules > Data Elements page, just like any other Data Element.  I think it should be fairly easy for you to at a minimum internally pass a reference to "this" to the custom script function for use.  But really, you can expand on Data Element functionality in general by adding "this" as the context (e.g. add a checkbox for it) for in the js object / css selector fields, as well.  

 

GTM has this sort of functionality with their Variables (formerly known as Macros), and in principle, this is no different that how "this" is available within the various custom code boxes in the rule.  It really is as simple as just passing "this" reference around.  

 

Anyways, if you did this, it will allow for us to keep all data elements in one place instead of having to make on-the-fly data elements buried within rules.