Javascript - when a tracking call has completed? | Community
Skip to main content
pwolly-cr
Level 2
September 22, 2020
Solved

Javascript - when a tracking call has completed?

  • September 22, 2020
  • 1 reply
  • 2211 views
Hello!
Does anyone know if there is a reliable way in javascript to detect whether the adobe analytics page tracking call (s.t()) has completed?  Currently, we are attempting to test for this via the below javascript (that tries to determine the state of the image beacon added to the page):
 
var pageViewComplete = function(){
    var pageViewPixel = window.s_i_scglobal;
    if (pageViewPixel && pageViewPixel.src && (pageViewPixel.src.indexOf('/b/ss/') >= 0) && pageViewPixel.complete){
      return true;
    }
    return false;
  };
 
We have noted that on occasion, the page view is recorded via an AJAX post to our adobe server vs the inclusion of the <img> tag, so the above code doesn't not always work.
 
Is there any Adobe supported way to test for this?
 
Thanks!
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Brian_Johnson_

@pwolly-cr  - Have you considered s.registerPostTrackCallback?

https://docs.adobe.com/content/help/en/analytics/implementation/vars/functions/registerposttrackcallback.html

1 reply

Brian_Johnson_
Brian_Johnson_Accepted solution
Level 8
September 22, 2020
September 22, 2020
Thanks @brian_johnson_. We had looked into using registerPostTrackCallback but in this case, the handler needs to make a link tracker call back to our Adobe (using s.tl()). The docs for registerPostTrackCallback warn against this - "Do not call any tracking calls like t() or tl() inside the registerPostTrackCallback variable. Tracking functions in this variable cause an infinite loop of image requests!" Any other thoughts?