# Interface: InteractionNamespace

Defined in: [interaction/types.ts:13](https://github.com/alleyinteractive/allegro/blob/6aebbf1d5d34ded3d128c093d7d30abd96d938be/packages/allegro-platform/resources/js/sdk/interaction/types.ts#L13)

Methods for triggering and managing on-page interactions.

Access this namespace via `allegro.interaction`.

## Methods[​](#methods "Direct link to Methods")

### remove()[​](#remove "Direct link to remove()")

> **remove**(`slug`): `void`

Defined in: [interaction/types.ts:68](https://github.com/alleyinteractive/allegro/blob/6aebbf1d5d34ded3d128c093d7d30abd96d938be/packages/allegro-platform/resources/js/sdk/interaction/types.ts#L68)

Remove an active interaction from the DOM.

#### Parameters[​](#parameters "Direct link to Parameters")

| Parameter | Type     | Description                            |
| --------- | -------- | -------------------------------------- |
| `slug`    | `string` | The slug of the interaction to remove. |

#### Returns[​](#returns "Direct link to Returns")

`void`

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

```ts
allegro.interaction.remove('newsletter-signup');

```

***

### renderActions()[​](#renderactions "Direct link to renderActions()")

> **renderActions**(`actions`, `options?`): `Promise`<`void`>

Defined in: [interaction/types.ts:49](https://github.com/alleyinteractive/allegro/blob/6aebbf1d5d34ded3d128c093d7d30abd96d938be/packages/allegro-platform/resources/js/sdk/interaction/types.ts#L49)

Execute a pre-built set of interaction actions directly.

This is the rendering half of [trigger](#trigger). Use it when you have already constructed the actions array (e.g. from local files in allegro-preview) and want to run them through the real SDK pipeline without fetching from the API.

#### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter             | Type                                                                                     | Description                                                                                        |
| --------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `actions`             | [`InteractionAction`](/developer/api-reference/type-aliases/InteractionAction.md)\[]     | The actions to execute.                                                                            |
| `options?`            | { `data?`: `Record`<`string`, `unknown`>; `skipDelays?`: `boolean`; `slug?`: `string`; } | -                                                                                                  |
| `options.data?`       | `Record`<`string`, `unknown`>                                                            | Arbitrary data passed to Alpine template context.                                                  |
| `options.skipDelays?` | `boolean`                                                                                | When true, skip scroll/time delays. Defaults to auto-detecting magic-link / allegro\_token in URL. |
| `options.slug?`       | `string`                                                                                 | Optional slug used for cleanup and Alpine context.                                                 |

#### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`void`>

***

### trigger()[​](#trigger "Direct link to trigger()")

> **trigger**(`slug`, `data?`): `Promise`<[`InteractionResponse`](/developer/api-reference/interfaces/InteractionResponse.md)>

Defined in: [interaction/types.ts:33](https://github.com/alleyinteractive/allegro/blob/6aebbf1d5d34ded3d128c093d7d30abd96d938be/packages/allegro-platform/resources/js/sdk/interaction/types.ts#L33)

Trigger an interaction by its slug.

Fetches the interaction from the API and executes its configured actions (template injection, CSS, JavaScript, cookies, etc.) on the current page.

#### Parameters[​](#parameters-2 "Direct link to Parameters")

| Parameter | Type                          | Description                                                                                |
| --------- | ----------------------------- | ------------------------------------------------------------------------------------------ |
| `slug`    | `string`                      | The interaction's unique slug as configured in the dashboard.                              |
| `data?`   | `Record`<`string`, `unknown`> | Arbitrary data passed to the interaction for use in template field values or action logic. |

#### Returns[​](#returns-2 "Direct link to Returns")

`Promise`<[`InteractionResponse`](/developer/api-reference/interfaces/InteractionResponse.md)>

The interaction record returned by the API.

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

```ts
await allegro.interaction.trigger('newsletter-signup');

// With extra data
await allegro.interaction.trigger('welcome-banner', { source: 'homepage' });

```

***

### ungate()[​](#ungate "Direct link to ungate()")

> **ungate**(`slug`): `void`

Defined in: [interaction/types.ts:80](https://github.com/alleyinteractive/allegro/blob/6aebbf1d5d34ded3d128c093d7d30abd96d938be/packages/allegro-platform/resources/js/sdk/interaction/types.ts#L80)

Reveal content that was gated by an interaction.

#### Parameters[​](#parameters-3 "Direct link to Parameters")

| Parameter | Type     | Description                                              |
| --------- | -------- | -------------------------------------------------------- |
| `slug`    | `string` | The slug of the interaction whose gate should be lifted. |

#### Returns[​](#returns-3 "Direct link to Returns")

`void`

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

```ts
allegro.interaction.ungate('paywall');

```
