# Step 5: Connect WebEngage campaigns

URL: https://www.digia.tech/docs/developer/webengage/connect-campaigns

WebEngage Change your setup in the sidebar
Link each WebEngage In-App (Custom HTML) campaign to a Digia Engage campaign with a digia-config block, so WebEngage decides who sees it.

Your app is ready to render campaigns. This step shows how a WebEngage campaign tells Digia what to render, and what to set on each campaign type.

## How Digia Maps to WebEngage Campaigns

> If you haven't read [How It Works](/docs/#how-it-works) in the overview, start there. The section below covers only what is WebEngage -specific.

In short: WebEngage decides **who** sees a campaign and **when** . Digia decides **what** is rendered. The two are linked by a `digia_campaign_key` you set in the WebEngage campaign's Custom HTML — the Digia plugin reads that key, resolves it against its local cache, and renders the right experience natively.

The table below shows how each Digia experience type maps to a WebEngage campaign type and which SDK component handles it on the app side:

| Experience Type | Digia Component | WebEngage Campaign Type | Description | **Nudge** | `DigiaHost` | In-App (Custom HTML) | Renders overlay experiences (bottom sheets, dialogs) above app content. | **Guide** | `DigiaAnchor` + `DigiaHost` | In-App (Custom HTML) | Step-by-step tooltip/spotlight flows anchored to specific UI elements. Each step targets a registered `anchorKey` . | **Survey** | `DigiaHost` | In-App (Custom HTML) | Multi-step survey flows rendered as overlays. | **Inline** | `DigiaSlot` | In-App (Custom HTML) | Renders inline content (banners, cards) within the app layout at a matching placement. 

Here is the end-to-end flow for an In-App campaign (Nudge, Guide, Survey, or Inline):

### The Campaign Contract

Whatever the experience type, a Digia-powered WebEngage campaign carries the same contract — a Custom HTML `digia-config` block of `<meta>` tags:

```html
<template id="digia-config">
  <meta name="digia_campaign_key" content="promo_offer_sheet">
  <meta name="coupon" content="SAVE20">
  <meta name="offer_title" content="Limited Offer">
</template>
```

- **`digia_campaign_key`** (required) — the key of the Digia campaign to render. This alone determines the experience type (nudge, guide, survey, or inline) and its design; nothing about the UI lives in the WebEngage payload.
- **Variables** (optional) — every other `<meta>` tag is a runtime value. Its `name` must match a variable defined on the campaign in the Digia dashboard; `content` is the value injected at render time.
Every experience type — nudge, guide, survey, and inline — is delivered through the same **In-App (Custom HTML)** campaign with this same `digia-config` block. The per-experience sections below show it in context.

## In-App Campaigns (Custom HTML)

WebEngage delivers in-app notification payloads to your app code when a campaign triggers. The Digia WebEngage plugin registers an in-app notification listener that intercepts this payload, reads the **`digia_campaign_key`** from the campaign's `digia-config` block, resolves it against the Digia campaigns pre-fetched at startup, and delegates rendering to Digia's runtime. **Without configuring the WebEngage campaign as Custom HTML with a `digia-config` block, the experience will not render.**

No device-side sync is required — the plugin responds automatically once registered. Configure your campaign in the WebEngage dashboard:

1. Log in to the **WebEngage dashboard** and go to **Campaigns → In-App Notifications** .
2. Click **Create** and give the campaign a name.
3. Configure the trigger event, audience, and schedule as required.
4. In the **Content** step, choose **Custom HTML** as the template type.
5. In the **Custom HTML** editor, add a `digia-config` block with your `digia_campaign_key` (see Trigger a Nudge from WebEngage below).

## Trigger a Nudge from WebEngage

In the WebEngage campaign **Custom HTML** editor, add a `digia-config` block. The `digia_campaign_key` links to your Digia campaign; any additional `<meta>` tags are passed through as runtime variables:

```html
<template id="digia-config">
  <meta name="digia_campaign_key" content="promo_offer_sheet">
  <meta name="coupon" content="SAVE20">
  <meta name="offer_title" content="Limited Offer">
</template>
```

| Meta tag | Required | Example value | Description | `digia_campaign_key` | Yes | `promo_offer_sheet` | The Digia campaign key copied from your Digia dashboard. Its type (nudge / guide / survey / inline) and design come from Digia. | any other `name` | No | `coupon` | A runtime variable. The `name` must match a variable defined on the Digia campaign; `content` is its value. 

> **Variables:** Every `<meta>` tag other than `digia_campaign_key` is a runtime variable. Its `name`**must match** a variable you defined on the campaign in the Digia dashboard — otherwise it is ignored. The `content` is the value injected at render time.

## Serve Inline Content from WebEngage

`DigiaSlot` is a composable/widget that renders Digia-powered content inline within your screen layout. Each slot is identified by a `placementKey` . When an In-App campaign whose `digia_campaign_key` maps to an **inline** Digia campaign triggers, Digia renders that campaign into the slot whose `placementKey` matches the slot key configured on the campaign in the Digia dashboard. If no campaign is active for a slot, it collapses to zero height.

Inline campaigns are delivered the same way as nudges — through an In-App (Custom HTML) campaign carrying a `digia_campaign_key` . Build the inline campaign in the Digia dashboard (it defines which slot / `placementKey` it renders into), then reference its Digia campaign key from the `digia-config` block:

```html
<template id="digia-config">
  <meta name="digia_campaign_key" content="home_hero_banner_campaign">
</template>
```

| Meta tag | Required | Description | `digia_campaign_key` | Yes | The Digia campaign key of an **inline** campaign copied from your Digia dashboard. The campaign defines which slot key it renders into. 

The app-side `DigiaSlot` / `DigiaSlotView``placementKey` must match the slot key configured on that campaign in the Digia dashboard.

info
Inline content stays loaded once a campaign renders it — it doesn't clear when the user's context changes. To clear it (for example on logout), seeManaging Inline Content .

## Link the WebEngage Campaign to Digia

To connect a WebEngage campaign to your Digia Guide, copy the **Digia campaign key** assigned to your Guide campaign in the Digia dashboard. Then, in the WebEngage In-App (Custom HTML) campaign, add a `digia-config` block with that key:

```html
<template id="digia-config">
  <meta name="digia_campaign_key" content="onboarding_tour">
</template>
```

> **Note:** The `digia_campaign_key` value must exactly match the Digia campaign key from the dashboard. If they differ, the plugin cannot resolve the campaign and nothing renders.

## Setting Up Surveys

Surveys are multi-step questionnaire flows you design in the Digia dashboard and render as overlays in the nudge host — no extra app-side widget is required beyond the [nudge container](/docs/developer/webengage/add-the-ui-pieces/#digiahost) . A survey is just another campaign type: create it in Digia, then trigger it from WebEngage by referencing its Digia campaign key via `digia_campaign_key` , exactly like a nudge.

1. Build the survey campaign in the Digia Engage Dashboard and copy its Digia campaign key.
2. Ensure your app mounts the nudge container — `DigiaHost` at the app root (all platforms).
3. Create a WebEngage In-App (Custom HTML) campaign and add a `digia-config` block set to the survey's Digia campaign key.

```html
<template id="digia-config">
  <meta name="digia_campaign_key" content="nps_q3_survey">
</template>
```

The survey renders over your app content and reports completion back through the plugin's analytics events.

## Personalize with variables

A Digia campaign shows personal values, such as a user's name or an offer amount, through `{{ variable }}` placeholders:

1. **Your campaign team declares the variables** in the Digia campaign's **Setup → Variables** step, each with a fallback value. Names use lowercase letters, digits and underscores, like `first_name` .
2. **The WebEngage campaign sends the values.** A value that's missing or empty uses the fallback.
3. **Let WebEngage fill in each user's value** with its personalization tags, so every user sees their own.
The campaign's **Integration details** panel in the Digia dashboard (on the **Review** step) gives you a ready-to-paste WebEngage config with a tag for each variable.

Keep every value in quotes. A value without quotes can make the whole set of variables unreadable.

Add one `<meta>` tag per variable in the `digia-config` block. Its `name` is the variable, and its `content` the value:

```html
<template id="digia-config">
  <meta name="digia_campaign_key" content="promo_offer_sheet">
  <meta name="first_name" content="{{user['custom']['first_name'] | default('there')}}">
</template>
```

## When several campaigns match

When one trigger matches several WebEngage campaigns, WebEngage shows only one, picked by its own rules (see [WebEngage 's documentation](https://knowledgebase.webengage.com/docs/in-app-homepage) ). Digia shows the campaign WebEngage sends. Digia also shows only one popup at a time: a campaign that arrives while another is on screen is dropped as `surface_busy` . SeeWhen Campaigns Overlap .

## Only target app versions that have Digia

A WebEngage campaign that points at a Digia campaign only works in app versions that include the Digia SDK. Users still on an older version of your app receive the WebEngage campaign too, but their app has nothing to show it with, so it doesn't appear correctly for them.

**Add an app version condition to the WebEngage campaign** , so it only targets your first app release with Digia and later. Raise that version again when a campaign uses something only a newer Digia SDK supports.
