> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# popupTestCreate

> Start a popup A/B test, as the popups page's Create test does. From now on, shoppers who would see a popup on `device` with `trigger` are split between the variants' popups by weight. Every variant's popup must use `trigger` and be shown on exactly `device`. A store runs one test per trigger on any device at a time (a `DESKTOP_AND_MOBILE` test covers both), and a popup is in one running test at a time. It publishes and unpublishes nothing. Fails with `BAD_USER_INPUT` (400) for a blank name, fewer than 2 or more than 3 variants, a blank variant name, the same popup twice, weights that don't sum to 100, a popup that doesn't use `trigger`, or a popup not shown on exactly `device`; `NOT_FOUND` (404) for a popup the store doesn't have; and `CONFLICT` (409) when a test with the same trigger is running on any of the same devices, or a popup is already in a running test.

**Required scopes:** [`campaigns_write`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_write)

## Arguments

**device** `[PopupDevice!](/docs/api-reference/v3/reference/marketing/popup-device)` *required*

Which shoppers' devices the test covers. Every variant's popup must be shown on exactly these devices.

**name** `String!` *required*

The test's name. Not blank.

**trigger** `[PopupTriggerChoice!](/docs/api-reference/v3/reference/marketing/popup-trigger-choice)` *required*

The trigger every variant's popup uses.

**variants** `[\[PopupTestVariantInput!\]!](/docs/api-reference/v3/reference/marketing/popup-test-variant-input)` *required*

The test's arms, 2 to 3, each a different popup.

**fields**

**name** `String!` *required*

The variant's name, as the test results show it. Not blank.

**popupId** `ID!` *required*

The popup's `id`, or its `legacyId` from an earlier version of the Redo API.

**weight** `Int!` *required*

The percentage of the test's shoppers shown this variant, from 0 to 100. The weights of a test's variants sum to 100.

## Returns

**popupTestCreate** `[PopupTest!](/docs/api-reference/v3/reference/marketing/popup-test)` *required*

A popup A/B test: it splits the shoppers who would see a popup on one device and trigger between two or more popups, and records how each does. Start one with `popupTestCreate`; end one with `popupTestConclude`.

**fields**

**device** `[PopupDevice!](/docs/api-reference/v3/reference/marketing/popup-device)` *required*

Which shoppers' devices the test covers. Its popups are shown on the same devices.

**endedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the test was concluded. Null while it runs, and for a test concluded before end times were recorded.

**id** `ID!` *required*

The id of this test.

**name** `String!` *required*

The test's name. Empty when it has none.

**startedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the test started. Null if it was never recorded.

**status** `[PopupTestStatus!](/docs/api-reference/v3/reference/marketing/popup-test-status)` *required*

Whether the test is running.

**trigger** `[PopupTriggerKind!](/docs/api-reference/v3/reference/marketing/popup-trigger-kind)` *required*

The trigger every variant's popup uses.

**variants** `[\[PopupTestVariant!\]!](/docs/api-reference/v3/reference/marketing/popup-test-variant)` *required*

The test's variants, in the order they were added.

**fields**

**id** `ID!` *required*

The id of this variant.

**name** `String!` *required*

The variant's name, as the test results show it.

**popup** `[Popup](/docs/api-reference/v3/reference/marketing/popup)`

The popup this variant shows. Null when the popup was deleted. Reading it needs the `campaigns_read` scope.

**Requires:** [`campaigns_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_read)

**fields**

**allowPageInteraction** `Boolean!` *required*

Whether shoppers can scroll and click the page behind the open popup. False locks the page behind it.

**campaignTargeting** `[PopupCampaignTargeting!](/docs/api-reference/v3/reference/marketing/popup-campaign-targeting)` *required*

Which UTM campaigns the popup is limited to.

**closeButton** `[PopupCloseButton!](/docs/api-reference/v3/reference/marketing/popup-close-button)` *required*

How the popup's close (X) button looks.

**completionTags** `[String!]!` *required*

Tags added to each customer who completes the popup, such as a signup. Empty when none.

**countryTargeting** `[PopupCountryTargeting!](/docs/api-reference/v3/reference/marketing/popup-country-targeting)` *required*

Which shopper countries the popup is shown in.

**createdAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the popup was created.

**device** `[PopupDevice!](/docs/api-reference/v3/reference/marketing/popup-device)` *required*

Which devices the popup is shown on.

**discountCode** `[DiscountCode](/docs/api-reference/v3/reference/marketing/discount-code)`

The discount offered in the signup flows the popup starts. Null when the popup offers no discount, or its discount was deleted. Reading it needs the `campaigns_read` scope.

**Requires:** [`campaigns_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_read)

**embedCode** `String`

The HTML snippet the merchant pastes into a page to show the popup inline, such as `<div id="redo-marketing-embedded-form-ab1cd"></div>`. Kept when the popup goes back to TRIGGERED, so a pasted snippet keeps working. Null until the popup is first made INLINE.

**frequencyCapHours** `Int!` *required*

How many hours the storefront waits before showing the popup to the same visitor again, from 1 to 720. 24 when the merchant never set one. Applies only to the TIME\_ON\_PAGE, EXIT\_INTENT and BACK\_IN\_STOCK triggers; the Intent AI triggers and inline popups ignore it.

**id** `ID!` *required*

The id of this popup.

**languages** `[String!]!` *required*

The languages the popup offers its copy in, as locale codes such as `fr` or `pt-BR`. The translations themselves are written in the builder. Empty when the popup shows only its authored copy.

**launcher** `[JSON](/docs/api-reference/v3/reference/common/json)`

The tab, banner or embedded button that opens the popup. Shape is `launcher` in `popupDesignSchema`. Null when the popup has none.

**legacyId** `String!` *required*

The popup's legacy Mongo ObjectId (24-char hex) from before the CockroachDB migration.

**localization** `[PopupLocalization](/docs/api-reference/v3/reference/marketing/popup-localization)`

The popup's supported languages, its translatable strings and its saved translations. Null if the popup was deleted while reading.

**Requires:** [`campaigns_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_read)

**name** `String!` *required*

The merchant-facing name of the popup. Empty when it has none.

**pageRules** `[\[PopupPageRule!\]!](/docs/api-reference/v3/reference/marketing/popup-page-rule)` *required*

Which storefront pages show the popup. Empty when it shows on every page.

**publishedAt** `[DateTime](/docs/api-reference/v3/reference/common/date-time)`

When the popup was last published. Null while it is unpublished.

**renderMode** `[PopupRenderMode!](/docs/api-reference/v3/reference/marketing/popup-render-mode)` *required*

Whether the popup opens over the page or shows inline in it.

**status** `[PopupStatus!](/docs/api-reference/v3/reference/marketing/popup-status)` *required*

Whether the popup is published.

**steps** `[JSON!](/docs/api-reference/v3/reference/common/json)` *required*

The popup's steps in order, each with its layout and elements, as the builder saves them. Shape is `steps` in `popupDesignSchema`. A `discountId` inside is the discount code's `legacyId`. Empty when the popup has no steps.

**target** `[PopupTarget](/docs/api-reference/v3/reference/marketing/popup-target)`

Which visitors the popup is shown to. Null when it has no audience setting.

**testUrl** `String`

Storefront URL that opens this popup for live testing, even while unpublished. Public and unsigned; does not expire. The storefront still enforces device and country targeting, so a mobile-only or geo-targeted popup won't show unless opened from a matching device and country. Null for back-in-stock popups (which require a product page with an out-of-stock variant) or when the store has no storefront domain.

**triggers** `[\[PopupTrigger!\]!](/docs/api-reference/v3/reference/marketing/popup-trigger)` *required*

What shows the popup, in the order the dashboard lists them. Only INLINE when it is embedded. Empty when no trigger is on.

**type** `[PopupType!](/docs/api-reference/v3/reference/marketing/popup-type)` *required*

How the popup is laid out on desktop, from its first step. POPUP when it has no steps.

**updatedAt** `[DateTime!](/docs/api-reference/v3/reference/common/date-time)` *required*

When the popup was last edited.

**results** `[PopupTestVariantResults](/docs/api-reference/v3/reference/marketing/popup-test-variant-results)`

What this variant has recorded. Costs 5 points per variant. Null when the results can't be read.

**Requires:** [`campaigns_read`](https://developers.redo.com/docs/api-reference/v3/reference/scopes#scope-campaigns_read)

**fields**

**completionRate** `Float`

`completions / views`, from 0 to 1. Null when the popup has no views.

**completions** `Int!` *required*

Times shoppers submitted the popup's last step that has an input, or its last step with a button when no step has an input.

**emailSignups** `Int!` *required*

New email subscribers from this variant's popup, not counting people already subscribed.

**engagements** `Int!` *required*

Times shoppers submitted any step of the popup, its last included.

**smsSignups** `Int!` *required*

New SMS subscribers from this variant's popup, not counting people already subscribed.

**views** `Int!` *required*

Times shoppers in this variant saw its popup.

**weight** `Float!` *required*

The percentage of the test's shoppers shown this variant, from 0 to 100. A test's weights sum to 100.

## Example

```graphql theme={null}
mutation {
  popupTestCreate(device: DESKTOP_AND_MOBILE, name: "...", trigger: BACK_IN_STOCK, variants: { ... }) {
    device
    endedAt
    id
    name
    startedAt
    status
    trigger
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.