repeating events on direct call after DTM to Launch Migration

jeys72304421

20-03-2019

Hi there,

We have migrated DTM to Launch and testing it. while I am testing the site, I see repeating event string appended to the events variable.

I have main page load event. that set to add event1, event42.

when user scroll down the content, I am calling a direct rule that add additional events (event1, event41, event51, event42). But this direct rule will be triggered again and again when user scroll through the page. It was working fine as expected in DTM. But after migration, when direct rules are called, it is appending events to each calls.

ex:

1st call (pageload): event1,event42

1st direct rule: event1,event42,event1,event41,event51,event42

2nd direct rule: event1,event42,event1,event41,event51,event42,event1,event41,event51,event42

and so on.

How can I eliminating this?

Accepted Solutions (1)

Accepted Solutions (1)

thomas_amsler

25-03-2019

First of all: Do your rules have a Clear Variables Action (this is needed in Launch compared to DTM)?

Second: if yes, what version of the Analytics Extension are you using. There seems to be a bug in AppMeasurement.js 2.11.0 which is part of the Extension since 1.6.0 that sometimes doesn't clear events even when using Clear Variables action: What are possible reasons why ClearVariable fails?

If you don't want to clear your variables between these calls, you may have to add custom logic, with code. I am using a simple helper method where the first parameter is s.events and the second a string containing one or more events separated by a comma:

function concatenate(orig, addition) {

   if (typeof orig === 'string' && orig !== '') {

   var concat = orig + ',' + addition;

   var values = concat.split(',');

   return values.filter(function(value, index, self) {

   return self.indexOf(value) === index;

  }).join(',');

  } else {

   return addition;

  }

}

The filter method makes sure that each event is only present once.