Installing the Pertento script
Learn how to install the lightweight Pertento script.
2 min read
To enable Pertento on your site, add the following script to your pages:
<script async id="pertentoScript" src="https://scripts.pertento.ai/pertentoRuntimeExperiments.YOURIDHERE.js"></script>
The script loads with minimal impact on performance. It handles experiment activation, variant rendering and event collection.
Placement
For optimal performance and user experience, place the script in the <head> of your site. This ensures the fastest possible activation and the smoothest visual experience for visitors. The script may also be deployed through tag management platforms if direct code placement is not possible, but <head> placement is strongly recommended whenever available.
Page Coverage
Ensure the script is present on all pages where experiments should run or be tracked. This includes checkout flows and thank-you or confirmation pages.
Integrity
Do not modify the script tag, its parameters or its ID. The website-id value is unique for each site and ensures correct activation and attribution.
Domain Specificity
Each Pertento script is bound to a single domain and must only be deployed on that domain. The website-id embedded in the script URL is issued per site and ties experiment configuration, variant assignment, and event collection to the origin it was generated for. Reusing the same script across multiple domains, subdomains outside the intended scope, or staging environments not registered for that ID could lead to:
- Incorrect attribution and mixed traffic in experiment data, producing invalid or unreliable results.
- Unexpected behavior on pages the script was not designed for, since selectors, variant code, and targeting rules are authored against the intended site's DOM and URL structure.
- Redirect and routing issues when experiments include URL-based targeting or redirect tests, as the script may trigger redirects intended for a different domain.
- Event collection firing against the wrong property, contaminating metrics and making post-test analysis unreliable.
If Pertento is used on multiple domains, request a separate script for each one. Do not copy an existing script tag from one site to another, and do not attempt to point a single script at additional origins through proxying or rewriting. Each environment that should run experiments, whether production, staging, or a regional variant, requires its own dedicated script and ID.
Consent Requirements
The Pertento script itself does not process personal data and does not require user consent. Consent is only needed if you implement additional tracking methods that involve personal data collection.