EVENT BASED RULES in DTM

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Hi everyone, I have 2 questions regarding DTM indeed. Any help would be appreciated.

1. event based rules

in Adobe Analytics section if I use partly interface for eVars/props/event and partly code it never works, it takes only values from interface, if I remove everything from interface and leave only code, it will pass everything like s.t() despite the box s.tl() is checked. That's pretty weird. What should I do as I need to use code in Open Editor for some logic

2. page load rules

I've noticed that page names are never overriden. For example if I set page-load rule with populating page names on the "bottom page" level and then on the "onload" or "dom" levels another page rule overriden the pagename, it will never override.

So for me it seems that the only possible case to set the custom page name for the specific page is - to create a page rule on the bottom level while setting the general rule for populating pages in the page load rule on the "onload" stage

Am I right?

 

Thanks in advance

Alexander

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

joelstachowicz

Employee

Avatar

joelstachowicz

Employee

joelstachowicz
Employee

15-10-2015

Hi Alexander,

This still looks like a timing issue from what I can see. The custom code does not appear to be firing in time to get passed with the s.tl() call. Here are a few things to check.

First, if you are targeting anchor tags, then check the "delay link activation" box next to the "click" event in the rule conditions. This provides a default 100ms delay to allow processing of the code prior to activating the tools and custom code. You can control the amount of time in the delay by going to the "edit property" button on the "overview" tab and clicking on the "advanced" options. Then just adjust the anchor delay time as necessary. This only works on anchor tags, so you will not see an effect if you are targeting clicks on different elements.

Next, if the situation persists, then validate that the custom code is firing correctly. Add some code like this to the custom code area and check to see if the debug messages show up in the javascript console.

_satellite.notify('setting prop6',1);
s.prop6="debug 1";

Type "s" in the console and see if prop6 ever gets set. If it does then there is a timing issue and the s.tl() is firing too quickly for the code to process. There can be a number of factors that can contribute to this situation, but if it does happen and you can't identify the appropriate delay points for the element then I would suggest using the DTM best practice of setting a data element equal to the value that you would like to set and referencing it in the UI portion of the rule. This will make sure that the value is referenced in time and processed correctly. Data elements also allow for very complex code to be evaluated prior to inclusion in a rule and make reuse simple between rules. This reduces processing time and improves the user experience.

Hope that helps. Let us know if that resolves the issue for you or if you would like some additional assistance.

-Joel

Answers (12)

Answers (12)

Avatar

Avatar

Ron_Coffman_102

Avatar

Ron_Coffman_102

Ron_Coffman_102

15-10-2015

I'm seeing the same issue - variables that were added via the UI are included in the event-based request, and the "list1" variable I set via the Custom Page Code editor is not.

Unfortunately I can't set a list variable via the UI...

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Now nothing works at all as I have the issue in the screenshot I've attached.

I'll be scrutinizing it tomorrow (that's odd, I didn't change the code) but maybe you know by chance what could be the culprit?

 

Alexander

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Hi Joel,

yes this plugin is very helpful, thanks

you are right about timing issue. However, as I said I tried many different options for the delay and nothing worked (even more than 1000 ms) and as you wrote a few messages earlier that I need to return some custom code for firing only once. So I wonder how to turn around this. I am currently aiming at the <h1> tag (it's inside <a> tag), Ill try the rule to <a> tag and I will let you know, maybe it will help

 

Regards, 

Alexander

Avatar

Avatar

joelstachowicz

Employee

Avatar

joelstachowicz

Employee

joelstachowicz
Employee

15-10-2015

Hi Alexander,

Can you elaborate a bit on what did not work?

The DTM debug mode can be turned on via the javascript console by entering _satellite.setDebug(true) and turn it off by entering _satellite.setDebug(false). This modifies a setting in localStorage, so you can reference it by entering localStorage.getItem('sdsat_debug') or you can load one of the Chrome or Firefox plugins to make it more simple http://help-forums.adobe.com/content/adobeforums/en/marketing-cloud-forum/adobe-marketing-cloud.topi... 

-Joel

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Hi Joel,

thanks for reply, I tried to try that on Friday but it didn't work, then we had a bunch of bank holidays, I tried to make that today as well but no results =/

What I do in the console I enter _satellite.setDebug(true)  however the output in the console I see undefined. the object _satellite is defined. There is no _satellite.isDebug() function to check the mode...

In the custom code I insert exactly what you provided me with _satellite.notify('debug',1)

When I click nothing comes up in the console

How this could be?

 

Thanks,

Alexander

Avatar

Avatar

dynahog

Avatar

dynahog

dynahog

15-10-2015

I have reported this issue as a bug within DTM last year in October. At that time, there was an issue with stage vs. production. In stage, the variables from the custom code did not appear in the tags.

The settings in the template would be included in the tag, but nothing from the custom code would be included. At the time it was identified as a bug and a solution was released.

I have seen many times where a solution has been released for an issue only to 'disappear' in a later release. Perhaps this has happened again. The incident was Incident: 131017-000173

Avatar

Avatar

joelstachowicz

Employee

Avatar

joelstachowicz

Employee

joelstachowicz
Employee

15-10-2015

Hi Alexander,

This is still a timing issue and can be corrected with a data element or a custom code condition. To verify that it is timing related just add a _satellite.notify('debug',1) to the event based rule's analytics custom code section and you will see it fire in the console when the click occurs (make sure that you have turned on debug mode with _satellite.setDebug(true) in the js console first).

Create a data element with a custom code section and add this to the code editor:

return s.getValOnce(fname,'evar7',0);

Make sure that 'fname' is defined or it will error.

Then assign the data element to the appropriate variable in the rule's analytics section. For example, eVar7 = %set_once_test%

Now, when the click occurs the rule will send eVar7 the first time that it is referenced in the session, and not on subsequent clicks within the same session.

If you want the rule to never fire after the first click then make the s.eVar7 value a condition in the rule or place the entire construction into a custom rule condition.

 

Hope that helps,

Joel

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Hi Joel,

I checked what an exact element was clicked and turned out that yes, it wasn't <a /> but h1 inside a tag. However, that rule was triggered (with not working custom code). Then I changed the rule conditions setting the rule to trigger when that h1 element is clicked, custom code didn't start working anyway =/

Could you please help me if there are any nice ways to setup that this rule is called only once per session?

for example in our current js code we use 

    if ( s.eVar7 = s.getValOnce(fname,'evar7',0) ) {

....... //firing s.tl() with parameters

}

as we can't use custom code now I wonder how can I implement this scenario by a different way =/

 

By the way I also found this issue http://help-forums.adobe.com/content/adobeforums/en/marketing-cloud-forum/adobe-marketing-cloud.topi...

I tried both patterns in the custom code 

  1. var s = arguments[1] || null;

and var s = window.s;

None of them worked for me =/

 

Thanks, 
Alexander

Avatar

Avatar

joelstachowicz

Employee

Avatar

joelstachowicz

Employee

joelstachowicz
Employee

15-10-2015

Hi Alexander,

Make sure that the targeted element is actually an anchor tag <a/> since that is the only element type that will be affected by the timing delay. Take a look at the actual element that is being clicked on as the click may be active on an image or some other element and not the anchor directly. More complex bubbling issues can be handled with the other UI options, but that's not necessary in most cases.

Hopefully the data element route will handle your immediate challenges though and you can process the data as expected.

Let us know if you need any further assistance.

-Joel

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Hi Joel,

thanks a lot of such a clear answer. Now everything matches. You're right about timing issue. It doesn't send vars/events set in the custom code but however after firing omniture if look at the s object, all that vars/events exist despite they were not passed when firing. However, there is one very arcane thing. I tried to fiddle around with the delay time and no matter what time I set (even a very very long time) this issue were persistent anyway =/ so I wonder if it ever works.

Also big thanks for advising to use a data element, this works very well and for this event based rule it fits prefect. So I will be using data elements instead of custom code in rules. 

 

Regards, 

Alexander

Avatar

Avatar

alexanderk11393

Avatar

alexanderk11393

alexanderk11393

15-10-2015

Hi Joel,

thanks for reply, sorry for late response, I've been on holidays.

However using third-party js doesn't help

I am attaching a screenshot that will help to shed light on what I mean. You can see that in one event based rule I am adding some variables by using the interface (event11 and also some eVars, I just cut off the screen to make it more readable) and I am also using the code where I set prop6 variable. This is a s.tl() event based rule.

However, when this rule is fired I can see that only variables set by the interface are passed. We need to make it able to write conditions partly in the interface, partly in the code window.

I also tried to create two separate event based rules where in one of them I use only the interface and in another one I use only the window code dialogue. However the second rule (when only window dialogue code conditions) triggers s.t() despite s.tl() is set.

 

Regards, 

Alexander

Avatar

Avatar

joelstachowicz

Employee

Avatar

joelstachowicz

Employee

joelstachowicz
Employee

15-10-2015

Hi Alexander,

In both the global Analytics custom code section and in the individual rule Analytics custom code, the code should be fired immediately prior to the beacon request. Have you tried entering the entire code block for the event based rule into a sequential third-party javascript to make sure that it fires correctly independent of the UI? There may be something else going on that we can investigate, but eliminate the UI first to rule that out as an issue.

Timing is probably the challenge for the page load rule. Take a look at the DTM timing sequence to make sure that the page name sets are occurring in the order that you expect. https://microsite.omniture.com/t2/help/en_US/dtm/#Load_Order_for_Rules

If you are still having issues after checking those options then just post back to this thread and we'll investigate further.

- Joel