1 year ago

#260322

test-img

Nasser Ali Karimi

How to track all gif request that is happening on the website by JavaScript?

I checked the network tab on chrome dev tools, there are many request that being done, one of them is Facebook request that sending pixel data to Facebook. I want to track those request and get the data that is a GET request.

Is that possible to fetch those request url by JavaScript? Then how, I don't have any idea around it.

  <script>
    console.log('request tracking!');
    var origOpen = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send = function() {
      console.log('request started!');
      this.addEventListener('load', function() {
        console.log('request completed!');
        console.log(this.responseURL);
      });
      origOpen.apply(this, arguments);
    };
  </script>

I tested this code, it returns some links but not all request that being done, at least get requests.

This is a sample get request I like to track https://www.facebook.com/tr/?id=245300970880426&ev=fb_page_view&dl=https%3A%2F%2Fgetmessiah.app%2Fdashboard&rl=&if=false&ts=1646638190415&sw=1600&sh=900&at=

Update It looks the Facebook request is gif, and till now I just fetched the list of xhr and fetch requsts.

enter image description here

javascript

facebook

url

pixel

tracking

0 Answers

Your Answer

Accepted video resources