- 26 Feb 2023
Integrate 1st-Party JS Snippet
- Updated on 26 Feb 2023
What is the PerimeterX 1st-Party JS Snippet? How do I integrate the snippet?
For deployments with server-side integration
The first party mechanism is a way for serving PerimeterX's JS sensor and for sending activities using your domain (1st party) rather than our own domains (3rd party).
1st party is needed since 3rd party scripts and XHR requests can get blocked by things such as network policies, privacy tools and ad blockers.
The first party mechanism uses the enforcer as a proxy to serve the client from the domain of the original page. The enforcer uses predefined reserved routes for first party.
- Improved performance: Serving the sensor as part of the standard site content removes the need to open a new connection to PerimeterX servers when a page is loaded.
- Improved detection: Third-Party content may be blocked by certain browser plugins and privacy add-ons. The First-Party sensor leads directly to improved detection, as seen with customers who previously moved from Third-Party sensor to First-Party sensor.
For certain Edge Enforcers, such as Fastly, the sensor sends the First-Party XHR by default.
Deploy the 1st party snippet
In the Snippet code window (Platform Settings -> Applications -> [[relevant application]] -> Snippet) Click the toggle to move it to first party. Make sure the routes shown in the pop up are accessible on the web server. You can also configure you routes under advanced configuration. We recommend that the snippet is the first script after ''. ` tag. If that is not an option, it should be inserted as high up in the HTML as possible.