Firing custom events in DCR




I'm having a few issues with firing events in a direct call rule.

The direct call rule is set up to fire on each section of a accordion type webpage. As the customer opens each section a satellite track with the DCR fires (it imitates a virtual page). This is all working as expected and updating props and eVars with values from a dataLayer. We update the dataLayer on each click so the DCR can capture the pageName and create the virtual page.

However I'm trying to set some events based on stages of these DCR firing (different pageNames).

For example if the customer hits the page and the DCR fires I want to set two events (one HIT and the other VISIT), I'm using this in the Adobe Analytics custom code:

/*Events - Start checkout*/

if (pageName == "step1") { = ? += ',' + 'event361,event461' : 'event361,event461';


This works but my problem is that the event is firing though each step, even if the pageName = "step2, 3, 4...."

I've tried amending the code to just simply

if (pageName == "step1") = event361

However it still persists through different steps

Hellllpppppp please, svp.

Accepted Solutions (0)

Answers (1)

Answers (1)


Community Manager


Is there a reason you are setting the in the custom code rather then via a rule? Where exactly is your JavaScript code at? Is it in the third-party section of a rule or in the Analytics tool itself?

I'm not sure why your JavaScript condition isn't being reevaluated each time the virtual page is loaded. I would maybe try to use a event based rule instead with a data element. You could set up a data element to extract the value of "step1" from the page and use that as as a condition in the event based rule. You could also use one of the SPA events like hash change if neeeded as an additional condition.