SDK Reference
The Allegro SDK is a browser JavaScript library that loads via a <script> tag
and exposes its API on window.allegro. It handles event tracking, member
authentication, and on-page interactions.
Quick Example
<script>
window.allegro = window.allegro || [];
window.allegro.push(function (allegro) {
// Track an event
allegro.track('article_read', {
content_id: '123',
content_type: 'article',
});
// Check if the current visitor is authenticated
if (allegro.member.isAuthenticated()) {
const payload = allegro.member.sessionFromJwt();
console.log('Hello,', payload.audience_member.name);
}
});
</script>
<script src="https://your-allegro-instance.com/client.js"></script>
window.allegro.push() queues callbacks that run as soon as the SDK is ready.
If the SDK has already loaded by the time push() is called, the callback runs
immediately.
Namespaces
| Namespace | Description |
|---|---|
allegro.track() | Track named events with automatic page context collection |
allegro.member | Authenticate and identify audience members |
allegro.interaction | Trigger and manage on-page interactions |