Skip to main content

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

NamespaceDescription
allegro.track()Track named events with automatic page context collection
allegro.memberAuthenticate and identify audience members
allegro.interactionTrigger and manage on-page interactions