Integration
Using Code Defender can be easily done in both cases of Sensor integration, Third Party or First Party.
To ensure optimal functionality of our Sensor, here are our Best Practice recommendations:
1. Snippet Code
First Party is the recommended integration.
example for PX_SENSOR_URL
- //client.px-cloud.net/PX1234/main.min.js
<script src="PX_SENSOR_URL" async ></script>
If custom parameters are needed:
<script type="text/javascript">
(function(){
// Custom parameters
// window._pxParam1 = "<param1>";
}());
</script>
<script src="PX_SENSOR_URL" async />
2. Snippet Location
The snippet should be placed within the <head>
tag.
The visibility of the Sensor can be affected if the snippet is not placed in the <head>
tag.
3. Snippet Order
Place the snippet at the top of the <head>
tag.
If it is placed lower in the head, the coverage will be less effective.
First party installation without an Enforcer
Because Enforcers are not required for Code Defender applications, you can implement a reverse proxy through your backend if you need a first-party installation without an Enforcer. This passes the request for the sensor resource through your backend to our CDN.
The implementation details depend on your backend architecture and, in particular, whether the first endpoint your resource requests hit is a CDN, load balancer, etc. For example, if you serve resources through a Fastly CDN, you can set it up to proxy the sensor resource request to the Human CDN. Here is an example of how it can be done with Fastly CDN.
Updated 12 days ago