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?
Solved! Go to Solution.
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.
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.
Hi,
I tried your suggested method already but I am facing a issue of clear other variables to like global evar values this i don't want to be clear.Please suggest best practice to overcome this issue.
Views
Replies
Total Likes
thanks thomas.amsler
I figured it out. it was missing Clear Variables Action. your answer will help on this forum.
Views
Like
Replies