Skip to main content

Guide Anchors and Inline Slots

How Digia Engage guides attach to DigiaAnchor and how DigiaSlot fills inline content, with placement tips for content that loads, moves or varies.

DigiaAnchor and DigiaSlot connect campaigns to specific places in your app. They're simple to add, but where you put them matters. This page explains how they behave and how to place them so campaigns show reliably.

For the code to add them, see Step 2: Add the UI pieces.

Guide anchors​

A guide is a tooltip or spotlight that points at something in your app, such as "Tap here to check out". DigiaAnchor tells Digia which element that is. You wrap the element and give it a name, the anchorKey. The element looks and works exactly as before.

How a guide uses anchors​

  • When a guide starts, Digia looks for the anchors its steps point at on the current screen.
  • A step whose anchor isn't on screen at that moment is skipped.
  • If the first step's anchor doesn't appear within 2 seconds, the guide doesn't show at all.
  • If an anchor is on screen but scrolled out of view, Digia scrolls it into view.
  • A guide stays on one screen. Leaving the screen ends it, so all the anchors of one guide must be on the same screen.

The best way to use anchors​

  • Anchor elements that are always there: tab bar items, toolbar buttons, the search bar, a screen's main button. These are in the same place for every user, every time.
  • One key per element. Don't give two elements on the same screen the same anchorKey.
  • Name keys by what they are: cart_checkout_button, not button_3.
  • Treat keys as permanent. Once a campaign uses a key, removing or renaming it in an app release breaks that guide for everyone on the new version. Tell your campaign team before you change one.

Be careful with content that changes​

Anchors work best on fixed parts of your UI. On content that loads, moves or differs between users, a guide can skip steps, not show, or point at the wrong thing:

SituationWhat goes wrongWhat to do
Content that loads later, such as a list filled from the networkThe guide may start before the element exists, so the step is skipped.Wrap the real element, not the loading placeholder. For campaigns Digia decides, ask your campaign team to start the guide with the Anchor visible trigger, so it waits until the element is on screen.
Items in a list or feed, such as search results or recommendationsThe item may not be there, may be a different item, or may be off screen. Long lists only build the rows you can see.Anchor something fixed instead, such as the list's header or filter button. If you must anchor a row, anchor only one, such as the first.
Repeated elements, such as an "Add" button on every product cardEvery card has the same key, so the guide can't tell which one to point at.Put the anchor on one card only, or on a fixed element nearby.
Elements only some users see, such as logged-in only features, A/B tests or feature flagsFor users who don't have the element, the step is skipped or the guide doesn't show.Tell your campaign team, so they target only users who see it.
Elements that move, such as items in a carousel, a collapsing header, or content that shifts while loadingThe tooltip can point at the wrong place.Anchor elements that stay still while the guide is showing.

Spotlights without an anchor​

A spotlight can also point at an element that has no DigiaAnchor. Your campaign team picks the element on a capture of the screen, taken from a debug build in SDK Debug Settings. So the two ways compare like this:

With an anchorWithout an anchor
How Digia finds the elementThe DigiaAnchor you added in codeThe spot your campaign team picked on a captured screen
Needs an app release firstYes, to add the anchorNo. Works on elements already in your released app.
AccuracyExact, on every deviceCan be slightly off on some screen sizes
Elements that scrollSupported: Digia scrolls the element into viewNot supported. Use only for elements that stay in place.
Best forMulti-step onboarding, and elements that may be off screenHighlighting a fixed element when you can't ship an app update first

Without an anchor, the step belongs to the screen it was captured on, so it depends on your app reporting screen names (see Reporting the Current Screen). Leaving that screen ends the guide.

Inline slots​

A slot is a space in your layout where inline content can appear, such as a banner at the top of Home. You place the slot and give it a name, the placementKey. Your campaign team then picks that slot when they build an inline campaign.

How a slot behaves​

  • Empty, it takes no space. When content arrives, the slot grows to fit it.
  • Content usually arrives a moment after the screen opens: once campaigns have loaded (a second or two after app start), or when the campaign's trigger fires.
  • Content stays when the user leaves the screen and comes back. It's cleared when the user dismisses it, a newer campaign replaces it, or the user logs out.
  • Content fits the slot's width, keeping its designed proportions.

The best way to use slots​

  • Place slots at natural breaks: the top of a screen, or between two sections.
  • Give the slot the width the content should use, usually the full width of the screen.
  • One slot per key. Don't use the same placementKey in two places at once. For several slots on one screen, give each its own key, such as home_top and home_middle.
  • Name keys by place: home_top, product_below_price.
  • Treat keys as permanent, as with anchors.

Be careful with content that changes​

SituationWhat goes wrongWhat to do
The slot grows when content arrivesEverything below it jumps down. A user about to tap a button can tap the wrong thing.Don't put a slot just above something users tap often. If a jump would hurt, give the slot's container a fixed height, and agree that size with your campaign team so their design fits it.
Slots inside a list or feedRows that come and go can move or remove the slot.Put slots at fixed positions, such as after the third item, not inside items that change.
Slots that are often off screen, such as in an inactive tab or far down a long pageThe campaign only counts as seen, and the Slot visible trigger only fires, when the slot is actually on screen.Put slots where users actually look.

Flutter: an empty slot still takes spacing​

On Flutter, an empty slot can leave a double gap in your layout.

What happens. Here an empty home_banner slot sits between two cards:

Column(
spacing: 16,
children: [
OfferCard(),
DigiaSlot('home_banner'), // empty: no campaign right now
DealsCard(),
],
)

You'd expect the cards to be 16 apart. They end up 32 apart: card, 16, the empty slot (0 tall), 16, card.

Why. In Flutter, a widget always takes a place in its parent's list of children. When a slot has nothing to show, DigiaSlot becomes a box of zero size, but it's still a child, and spacing adds a gap on each side of every child, whatever its size. The SDK can't fix this, because no Flutter widget can remove itself from its parent's list. Android and iOS don't have this problem: an empty slot there adds nothing to the layout.

Where it happens. Anywhere Flutter adds space between children:

  • spacing on Column, Row, Flex and Wrap. Using Expanded or Flexible doesn't change it.
  • Separators in ListView.separated: an empty slot gets a separator on each side.
  • Grids: in a GridView, an empty slot still takes up a whole cell.

What to do.

  1. Don't put a slot in a container that adds spacing between its children. Space the other children yourself, so the slot adds space only when it has content:

    Column(
    children: [
    OfferCard(),
    DigiaSlot('home_banner'),
    const SizedBox(height: 16),
    DealsCard(),
    ],
    )

    Empty, this gives card, 16, card. Filled, the banner sits right under the first card, then 16, then the second card.

  2. For a gap around the banner when it shows, ask your campaign team to give the inline content a margin in Campaign Canvas. The margin is part of the content, so it only appears when the slot is filled.

  3. Keep slots out of grids and separated lists. Place the slot above or below the grid or list instead.