# Quick Start

This guide walks you through adding the Allegro SDK to your site and sending your first custom event.

## 1. Add the Script Tag[​](#1-add-the-script-tag "Direct link to 1. Add the Script Tag")

Add the Allegro loader to the `<head>` or before `</body>` of your HTML:

```html
<script src="https://your-allegro-instance.com/client.js"></script>

```

Replace `your-allegro-instance.com` with your actual Allegro domain.

## 2. Track a Custom Event[​](#2-track-a-custom-event "Direct link to 2. Track a Custom Event")

Page views are tracked automatically. To track a custom event, initialize the queue and push a callback:

```html
<script>
    window.allegro = window.allegro || [];

    window.allegro.push(function (allegro) {
        allegro.track('article_share', { method: 'email' });
    });
</script>

```

## 3. Setup Page Metadata[​](#3-setup-page-metadata "Direct link to 3. Setup Page Metadata")

The SDK auto-collects page metadata from the GTM data layer. Add a meta tag to your `<head>`:

```html
<meta
    name="gtm-dataLayer"
    content='{"gtmStoryTitle":"My Article","gtmPageType":"article","gtmBspStoryId":"12345","gtmSiteName":"Example News","gtmCategory":"tech"}'
/>

```

Or pass metadata explicitly to `track()`:

```js
allegro.track('page_view', {
    content_id: 'article-123',
    content_type: 'article',
    publisher: 'Example News',
});

```

## Complete Example[​](#complete-example "Direct link to Complete Example")

```html
<!DOCTYPE html>
<html>
    <head>
        <meta
            name="gtm-dataLayer"
            content='{"gtmStoryTitle":"My Article","gtmPageType":"article","gtmBspStoryId":"12345","gtmSiteName":"Example News","gtmCategory":"tech"}'
        />
    </head>
    <body>
        <script>
            window.allegro = window.allegro || [];

            // Track a custom event (queued until SDK loads)
            window.allegro.push(function (allegro) {
                allegro.track('article_share', { method: 'email' });
            });
        </script>

        <script src="https://your-allegro-instance.com/client.js"></script>
    </body>
</html>

```

## Next Steps[​](#next-steps "Direct link to Next Steps")

* [Event Tracking guide](/developer/guides/event-tracking.md) — all `track()` options and page data collection
* [Member Authentication guide](/developer/guides/authentication.md) — authenticate readers with the SDK
* [Web Components](/developer/components/login-form.md) — drop-in UI components for login and email capture
