Docs Any website
Install the script
Two lines in the head of every page.
Add these two lines to the <head> of every page, replacing 129 with your site ID. Put them in your layout or template so every page gets them.
<script>window.OPL_INSIGHTS = { m: 'https://insights.opl-web.com/', s: 129 };</script>
<script async src="https://insights.opl-web.com/plugins/OplReplay/javascripts/opl-insights.js"></script>
The first line is the configuration; the second loads the script without slowing your page down. That's all a plain website needs: page views, recordings, heatmaps and diagnostics start straight away.
Don't add the standard Matomo tracking code as well. The OpL Insights script loads it itself, and having both counts every page view twice.
Check it works
- Open your site in a private window and click through a few pages.
- In OpL Insights, open your site, then Visitors > Recordings. Your visit appears within seconds.
- If nothing appears, open the browser console and run the line below, then reload. The script prints what it is doing, prefixed with
[OpL Insights].
OPL_INSIGHTS.debug = true; sessionStorage.clear(); location.reload();
Next steps
- Identify signed-in users so recordings show who the visitor was.
- If your site is a single-page app, turn on single-page app tracking.
- Check the hosting checklist if you use a Content-Security-Policy.