Search code examples
tagsadobeweb-analyticsadobe-analytics

Adobe DTM rules based on Data Element activation



I tried to condition Page-load rules (Custom criteria) on Data Element activation, in order to fire them only if Data Element are active.
I mean the real Data Element activation in its Adobe DTM editing interface.

I attempted the condition below:
if (typeof _satellite.getVar('DataElement_name') != 'undefined') { return true; } else { return false; }
because I discovered that an inactive Data Element makes "getVar()" method return "undefined".
This does not work, and the rule is fired anyway.

This was my second chance, after a first attemp to use the built-in method "isRuleActive()".
Unfortunately this seems to always return true, even if the Data Element is inactive.
But then, I'm not sure if Data Element could be used with this method.

My scenario concerns some Page-load rules built upon Data Elements, which are explicitly called with "getVar()" into their custom code.
If those Data Elements are inactive, the rules will go wrong and javascript errors will come up.
This is the reason why I'd like to add a Custom criteria condition to these rules, based on Data Element activation.

Thanks


Solution

  • What are the possible returns of your data element?

    You can try to use this method to check out the returns:

    _satellite.dataElements.Your-data-Element-name.customJS();
    

    I recommend that you make your data element return false and in your rules you can choose criteria for "data element value".

    Hope this helps!