Quick Start
Add one <script> tag with your API key.
<script
src="https://cdn.periscale.app/analytics.min.js"
data-api-key="sb_live_your_api_key_here"
defer
></script>That's it. The tag immediately starts capturing pageviews, web vitals, scroll depth, and JS errors. To capture e-commerce events, add a few data-p-* attributes to your existing elements — see Auto-capture.
The same key as the chat widget
Your sb_live_* business key authorizes both the chat widget and the analytics tag. You don't need a separate analytics key.
Verify it's working
Open your browser's DevTools → Network tab and filter by secure. As you navigate the site, you'll see batched POST requests every ~10 seconds (or on pagehide). Each batch contains one or more events.
Or call this from the JS console at any time to force a flush:
window.periscale.flush();Identify a logged-in user
Once you know who the visitor is, link the anonymous events to them:
window.periscale.identify("user-123", {
email: "user@example.com",
plan: "pro",
});After this, every subsequent event is associated with user-123. The chat widget shares this identity, so the visitor's chat history and analytics line up.
Next
- Tag attributes — every script tag attribute
- Auto-capture —
data-p-*conventions - JavaScript API —
track,identify,group,reset