7

I want to fire a

fbq('track', 'PageView');

event (and its noscript counter part). However, I want to specify the URL that is viewed myself, since the "PageView" in question is actually an overlay and its content is loaded via an XHR request (and the URL stays the same).

However, I am wondering if this is possible at all. The documentation for the custom parameters don't mention anything about a custom URL for the PageView event for example.

Would this work, if I added

window.history.pushState({"html":…},"", this.url);

for example, so the URL of the (AJAX loaded) overlay is also in the browser's history and thus the tracking ov PageView uses this URL as well?

4
  • Read "custom parameters" as "whatever the hell you like". fbq('track', 'eventName', {myCustomURL: 'http://stackoverflow.com'}); Commented Apr 19, 2017 at 8:32
  • But that would be a custom event - not the PageView event.
    – fritzmg
    Commented Apr 19, 2017 at 8:36
  • According to the docs, a custom event has a custom name, and "track" is a standard event name, which makes it a standard event. Commented Apr 19, 2017 at 8:38
  • Yes, but that is not what I mean. I do not want to track a custom event. I want to track the PageView event, with a custom URL.
    – fritzmg
    Commented Apr 19, 2017 at 8:39

0

Browse other questions tagged or ask your own question.