Expand my Community achievements bar.

SOLVED

Filter Link Tracking issue in Adobe DTM

Avatar

Level 2

Hi Everyone,

I am facing issue with adobe image request in network tab, I can proper see results in console, but while in image request I am not seeing Evar55 current value.

Actually there is bug Analytics tracking issue- Evar55

Evar55 should capture the value of filter selected by users on search result page and PLP.

So now the next thing I have written the code, which is working absolutely fine in Console, and I can see the result but in network tab the image request is giving previous value not giving the current value of facet.

Here I am sharing the screenshot and code with you, please tell what issue is.

In DTM, I have created page load rule – conditions trigger rule at DOM ready –then adobe analytics open editor I have pasted this code

*********************************************************************

Code

var oldXHR = window.XMLHttpRequest;

function newXHR() {

    var realXHR = new oldXHR();

realXHR.addEventListener("readystatechange", function() {

if(realXHR.readyState==4 && realXHR.status==200){

           //run your code here

  1. window.setTimeout(function() {

if(s.pageName && (s.pageName.indexOf('plp:')>-1 || s.pageName.indexOf('search')>-1)){

var PFF = document.getElementsByClassName('selected-categories')[0].innerText;

PFF_Final = PFF.replace(/ /g, '').replace(/:/g, '|');

if(PFF_Final.indexOf('Categories|')>-1 || PFF_Final.indexOf('search|')>-1){

  1. console.log('N/A');

}

else if(PFF_Final && typeof PFF_Final !== 'undefined' && PFF !== 'null' && PFF !== ''){

//PFF_Final = PFF.replace(/ /g, '').replace(/:/g, '|');

   s.linkTrackVars = 'eVar91';

   s.eVar91 =  PFF_Final.trim();

//s.tl(this, 'o');

  1. console.log(PFF_Final);

}

}

},1500);

        }

    }, false);

    return realXHR;

}

  1. window.XMLHttpRequest = newXHR;

Note : - I have change the Evar55 to Evar91 because Evar 55 which is already in use.

bug 1.jpg

Results in network.png

Results in Console.png

Thanks,

Payal

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Pay,

After taking a look at your implementation and rule, I'm assuming the problem is the order the code is firing. In your rule, you are setting most of the Analytics variables within the DTM UI. The variable you are having the issue with is set in the custom code section of the Analytics portion of the rule. I believe this code is being executed after the Analytics beacon has already fired. This is why you are able to call the data element in the console and retrieve the expected value.

My suggestion would be to move that code either into the conditions section before returning true or putting that code within the data element that sets eVar 55. You can then set eVar 55 = to the data element in the DTM UI. This will cause DTM to call the data element when the condition is met and before the beacon fires. When the rule calls the data element, the code within that data element will be run and your value can be assigned to the data element. When the value is retrieve from the data element, the rest of the Analytics code will fire and send of the Analytics beacon.

Try that and let's see if that fixes the issue.

Cheers,
Jantzen

View solution in original post

8 Replies

Avatar

Level 10

It sounds like you've got something overwriting your eVar55 variable. Based on your screenshots, when you switch DTM to set the product families to eVar 91 everything works as expected. Is that correct or did I misunderstand?

If that is correct, you'll want to find what is also trying to set eVar 55 and disable that rule.

Avatar

Level 2

Hi Jantzen.Belliston​ & ParitMittal​,

I am facing issue with evar 55 and prop 55.

Above one scenario which I mentioned is not correct, so I am posting the exact scenario.

I am facing issue with adobe image request in network tab, I can proper see results in console, but while in image request I am not seeing Evar55 current value. Actually there is bug Analytics tracking issue- Evar55

Evar55 should capture the value of filter selected by users on search result page and PLP.

So now the next thing I have written the code, which is working absolutely fine in Console, and I can see the result but in network tab the image request is giving previous value not giving the current value of facet.

Here I am sharing the screenshot and code with you, please tell what issue is.

Filter clicks_1.PNG

but s.eVar55 is not showing value when first time filter click happened but from second time onwards it shows the previous value

"Code which i have written in adobe DTM custom editor"

if(_satellite.getVar("payal evar55/prop55 test") && _satellite.getVar("payal evar55/prop55 test") !== null){
  s
.linkTrackVars='eVar55,prop55';
  s
.eVar55=_satellite.getVar("payal evar55/prop55 test");
  s
.prop55=_satellite.getVar("payal evar55/prop55 test");
}

If anyone can help me out that would be highly appreciated.

Thanks,

Pay

Avatar

Level 10

Hi Pay,

Is there a URL you can share where I can test this? Also, what is the name of the rule where you are setting eVar 55?

Thank you,

Jantzen

Avatar

Level 2

Hi Jantzen.Belliston​,

Yesterday I sent some URL's with adobe DTM rule.

Thanks,

Pay

Avatar

Correct answer by
Level 10

Hi Pay,

After taking a look at your implementation and rule, I'm assuming the problem is the order the code is firing. In your rule, you are setting most of the Analytics variables within the DTM UI. The variable you are having the issue with is set in the custom code section of the Analytics portion of the rule. I believe this code is being executed after the Analytics beacon has already fired. This is why you are able to call the data element in the console and retrieve the expected value.

My suggestion would be to move that code either into the conditions section before returning true or putting that code within the data element that sets eVar 55. You can then set eVar 55 = to the data element in the DTM UI. This will cause DTM to call the data element when the condition is met and before the beacon fires. When the rule calls the data element, the code within that data element will be run and your value can be assigned to the data element. When the value is retrieve from the data element, the rest of the Analytics code will fire and send of the Analytics beacon.

Try that and let's see if that fixes the issue.

Cheers,
Jantzen

Avatar

Level 2

Hi Jantzen.Belliston​,

I tried your solution, but it's not working. Can you share your skypeid, so that i can share my screen and i will show you what is happening.

Avatar

Level 10

Pay,

If you'd like to have someone share your screen and troubleshoot, you'll need to contact Customer Care. They have the tools and availability to setup a screen sharing session. If you do contact them, be sure to reference this thread so they can review what we've already tried.


Thanks,
Jantzen

Avatar

Level 2

Hi Jantzen.Belliston

Sorry for giving you the late reply, I am not understanding how to set the condition and where, because already they have set so many variables in that section.