As a caveat this is an **unofficial** way of achieving this as of this article’s writing…
The question is why would you even want to change where events are sent to in the first place?
For certain Server-Side implementations (e.g. GTM Server-Side implementations with the Facebook Conversion API) there is a need to send your events to a different url other than https://facebook.com/tr .
There is an unofficial and undocumented method that will allow you to do this out-of-box. I had to read the pixel code to find this out, but it seem to be an effective way to modify the endpoint that the Facebook Pixel sends to. In a sense, it is like the “transport_url” for GA.
To the JS endpoint in the FB pixel you can call the “set” function with “endpoint” then override the default server that “tr” calls are made to. So just add the following line before your fbq calls and it will override FB’s default endpoint URL:
- fbq('set', 'endpoint', ' https://yoururl.com/tr');
So how your pixel code could resemble would be. When you run the script you’ll see that the calls are now being made to the endpoint you added.
- !function(f,b,e,v,n,t,s)
- {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
- n.callMethod.apply(n,arguments):n.queue.push(arguments)};
- if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
- n.queue=[];t=b.createElement(e);t.async=!0;
- t.src=v;s=b.getElementsByTagName(e)[0];
- s.parentNode.insertBefore(t,s)}(window, document,'script',
- 'https://connect.facebook.net/en_US/fbevents.js');
- fbq('set', 'endpoint', ' https://yoururl.com/tr');
- fbq('init', '<YOUR_PIXEL_ID>');
- fbq('track', 'PageView');
There are many benefits to verify your Business Manager on Facebook; however, it is not…
One issue when adding the Facebook pixel to a Google Tag Manager AMP container is…
When trying to run Puppeteer 1.0 within your Node.JS scripts on an Ubuntu 16.04 box and…
Off the back of this article, there could be some potential improvements to make the…
Before implementing the img tag, the previous article should be reviewed: it discusses some of…
When it comes to Facebook Marketing as well in life, there are things we can…