For the most part SPAs (Single Page Applications) will be a similar setup to server rendered apps, however, there are a few differences you will want to account for.
Firstly you will want to ensure that you are sending the proper Current URL and Referrer URL when you are making requests. Some frameworks do not update the native browser locations and therefore our pixel does not get the correct URL and referrer. See the sections in our docs in order to see how to override URLs.
Additionally, since SPAs don’t actually reload pages you will need to manually call the
jdxtag() function each time a user navigates to a new route. For instance, in React you may want to have a useEffect run when the component for that page mounts initially (though be careful to make sure it does not send each re-render).
An example setting the current and referrer URL before making the request:
jdxtag('options', '_currentUrl', 'http://www.your-website.com/route/page') jdxtag('options', '_referrerUrl', 'http://www.your-website.com/route/previous-page') jdxtag('_track')