javascript - Filter Link Tracking issue in Adobe DTM -


i facing issue adobe image request in network tab, can proper see results in console, while in image request not seeing evar55 current value. there bug analytics tracking issue- evar55

evar55 should capture value of filter selected users on search result page , plp.

so next thing have written code, working absolutely fine in console, , can see result in network tab image request giving previous value not giving current value of facet.

here sharing screenshot , code you, please tell issue is.

in dtm, have created page load rule – conditions trigger rule @ dom ready –then adobe analytics open editor have pasted code


code

var oldxhr = window.xmlhttprequest;  function newxhr() {     var realxhr = new oldxhr(); realxhr.addeventlistener("readystatechange", function() { if(realxhr.readystate==4 && realxhr.status==200){            //run code here 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){ 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'); console.log(pff_final); }  } },1500);         }     }, false);     return realxhr; } window.xmlhttprequest = newxhr; 

note : - have change evar55 evar91 because evar 55 in use.

enter image description here

enter image description here

thanks, payal

at face value, immediate reason code posted not make request because have s.tl call commented out...

second, note: if filtering image requests in network tab, not see adobe analytics (aa) request there, because unless using ancient browser or else have javascript turned off , using <img> tag method, show either javascript request or ajax (xhr) request (depending on version of aa library , how long request is).

if still not seeing request, there couple additional things try. 1 or more of these may or may not true/necessary, depending on version of aa library using:

1) when pass this first argument, must valid anchor element href attribute <a href='..'></a>. since not applicable within context of posted code, try changing first argument boolean true.

2) add 3rd argument s.tl call. argument supposed description link click, e.g. s.tl(true,'o','some link'); can want; it's shows in native link reports in aa (that ignore, in favor of looking @ evar91 report, instead). versions of aa library require 3rd argument if want track click/interaction server call. without it, in more recent versions of aa, trigger request page view call, in older versions of aa library, not trigger call @ all.

3) again, depending on aa lib version, not include above evar75. don't remember exact aa version evar76+ introduced (edit: looks starting am1.4. legacy h code not supported). quick check, try using evar75 or lower see if shows in request. note: i'm putting completeness sake, don't think issue, since seems post may have tried evar55 already? may certain. if case, suggest updating latest appmeasurement library. if reason unable that, , still need use evar91, alternative pop contextdata variable, e.g. s.contextdata['evar91']='foo'; , map real evar91 in processing rule within aa interface. if aa library old enough contextdata variables don't work (h23.2 or lower).. suggest make highest priority in life upgrade more recent version of aa lib..

if after of still not see aa call, type s.t(true,'o','foo'); js console. see http request? if do not see request, have deeper issue not directly related posted code. perhaps aa library not present, or not loaded before triggered, or under different namespace default s namespace. it's not feasible write lots of random guesses here vs. looking @ site.

if do see request, best guess @ point having timing issue. perhaps there page (re)load happening , not getting chance trigger? again, it's not feasible speculate on site unseen.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -