Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

DTM data elements - add 'this' context support

Avatar

Avatar
Ignite 3
Level 9
Josh_Du
Level 9

Likes

275 likes

Total Posts

241 posts

Correct reply

70 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 100
Give Back 50
Give Back 25
View profile

Avatar
Ignite 3
Level 9
Josh_Du
Level 9

Likes

275 likes

Total Posts

241 posts

Correct reply

70 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 100
Give Back 50
Give Back 25
View profile
Josh_Du
Level 9

01-10-2016

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.