Expand my Community achievements bar.

SOLVED

custom conditions

Avatar

Level 2

Hi there,

when I am creating a "custom" criteria on Pageload or Event rules, is there anyway with in the script I can know the name of the rule the condition is checking against?

I have looked in the "this" and "arguments" scope, but can't find any reference to the context the condition is triggering against.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 9

The short version is no, DTM does not expose the rule name for you to reference.

I have spent a fair amount of time trying to find some unofficial method or property with it, but it is simply not exposed within the scope of anything you can passively do.

I have also spent a fair amount of time figuring out the least invasive way to alter the _satellite object to give me what I want, and.. while I have done it in a sandbox, it is not something I have or will ever actually use in practice. (Adobe won't even support passively using existing internal methods/properties, let alone actually changing the DTM library).

The good news is this is something a lot of people have asked for over the years, and Adobe has listened and added it to Launch, if/when you migrate from DTM to Launch.

View solution in original post

5 Replies

Avatar

Level 10

I'm not sure I understand the question.

If you are writing a custom condition within a Page Load or Event rule, that condition is only applied to that rule. Are you trying to debug something on the page to figure out which rule the custom condition is in, or is there another use case I'm not seeing?

Avatar

Level 2

Hi Jantzen,

Thanks for taking the time to answer this.

What I would like to do is have a custom condition, and the if the check fails, add the name of the rule to a global variable.

pseudo code:

----------------------------------------------------------------

var result = ( [custom condition logic] );

if( !result ) window.failedRuleArray.push([the name of this rule]);

return result;

----------------------------------------------------------------

for this to work, the condition needs to know the name of the rule/context it is firing within.

The reason for this is that if the user then does and interaction on the page (without reloading the page) that would make the "[custom condition logic]" return true, we can iterate over the rules that previous failed and trigger them off.

This is all related to the General Data Protection Regulation (GDRP) changes

Avatar

Level 10

I'm not aware of a way to accomplish what you're looking for as it will likely require a bit of custom coding. One of our super users on the community ofter comes up with solutions for use cases like this. I'll tag him below to see if he has any ideas.

joshd7227840

Avatar

Correct answer by
Level 9

The short version is no, DTM does not expose the rule name for you to reference.

I have spent a fair amount of time trying to find some unofficial method or property with it, but it is simply not exposed within the scope of anything you can passively do.

I have also spent a fair amount of time figuring out the least invasive way to alter the _satellite object to give me what I want, and.. while I have done it in a sandbox, it is not something I have or will ever actually use in practice. (Adobe won't even support passively using existing internal methods/properties, let alone actually changing the DTM library).

The good news is this is something a lot of people have asked for over the years, and Adobe has listened and added it to Launch, if/when you migrate from DTM to Launch.

Avatar

Level 2

Thanks for the help Josh!

I'll look in to Launch migration sometime, after GDRP changes complete! ;-)