> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-event-stream-action-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Experiment Center and Page Templates Integration

> How experiment context flows through Auth0 Universal Login page templates and partials, and how to branch template rendering based on variation.

export const ReleaseStageNotice = ({feature, stage, plans, contact, terms}) => {
  const stageTextMap = {
    "beta": "Beta",
    "ea": "Early Access"
  };
  const stageText = stageTextMap[stage] || "a product release stage";
  const prsLink = "/docs/troubleshoot/product-lifecycle/product-release-stages";
  const linkify = (text, url) => {
    return <a href={url} target="_blank" rel="noreferrer" class="link">{text}</a>;
  };
  const includeDetails = (plans, contact, terms) => {
    const hasDetails = terms || plans || contact;
    if (!hasDetails) return null;
    return <span data-as="p">
            {plans && <>This feature is available for {linkify(`${plans} plans`, "https://auth0.com/pricing")}. </>}
            {contact && "To participate, contact " + contact + ". "}
            {terms && <>By using this feature, you agree to the applicable Free Trial terms in Okta's {linkify("Master Subscription Agreement", "https://www.okta.com/legal")}.</>}
        </span>;
  };
  return <Warning>
            <span data-as="p">
                <strong>The {feature} feature is in {linkify(stageText, prsLink)}.</strong>
            </span>

            {includeDetails(plans, contact, terms)}
        </Warning>;
};

<ReleaseStageNotice feature="Auth0 Experiment Center" stage="beta" terms="true" contact="Auth0 Support" />

When an experiment is active and a variation is assigned, the Experiment Center injects experiment context into the [page template](/docs/customize/login-pages/universal-login/customize-templates#customize-universal-login-page-templates), rendering context automatically. Page templates do not require an opt-in step: experiment context is passed to all templates unconditionally when an experiment is active. Templates receives the context as a local variable named `experiment`.

<Warning>
  During Beta, Experiment Center runs on development tenants only. Production tenants are not supported.
</Warning>

## Available context fields

The following fields are available in the page template when an experiment is active:

| **Variable**               | **Type** | **Description**                                                 |
| -------------------------- | -------- | --------------------------------------------------------------- |
| `experiment.experiment_id` | string   | The active experiment ID                                        |
| `experiment.variation_id`  | string   | The assigned variation ID                                       |
| `experiment.config`        | object   | Merged configuration: baseline parameters + variation overrides |
| `experiment.is_control`    | boolean  | Whether this is the control variation                           |

When no experiment is active, `experiment` is `null` (or not present). Always null-check before using.

### `experiment.config` structure

`experiment.config` is a key/value map where each key is a parameter name and each value is an object with a `value` property:

```
experiment.config.my_param.value  → the parameter's value for this variation
```

Every parameter defined on the feature flag has a value in `config`. Experiment Center merges the baseline parameters with the variation's overrides before injection, so you never need to look up the default yourself.

## Read a parameter in a template

Auth0 Universal Login page templates use EJS. The examples below use EJS syntax.

**EJS syntax:**

```html theme={null}
<%= experiment && experiment.config.heading_text.value %>
```

With a null check:

```html theme={null}
<% if (experiment) { %>
  <h1><%= experiment.config.heading_text.value %></h1>
<% } else { %>
  <h1>Create your account</h1>
<% } %>
```

## Customize signup and login with Partials

When you customize Signup and Login prompts using [partials](/docs/customize/login-pages/universal-login/customize-signup-and-login-prompts#manage-partials-programmatically), the experiment context is passed explicitly as part of your partial.

In the partial, the same `experiment` variable is available:

```html theme={null}
<!-- partials/signup-header.ejs -->
<header>
  <h1>
    <% if (experiment && experiment.config.heading_text) { %>
      <%= experiment.config.heading_text.value %>
    <% } else { %>
      Create your account
    <% } %>
  </h1>
</header>
```

## Example: signup headline copy variant

This example shows a feature flag with a string parameter that controls the signup page headline. The control variation uses "Create your account"; the treatment uses "Join in seconds."

**Feature flag parameters:**

```json theme={null}
{
  "signup_headline": {
    "type": "string",
    "value": "Create your account",
    "description": "Headline text on the signup screen"
  }
}
```

**Control variation:** empty overrides (inherits `signup_headline: "Create your account"`)

**Treatment variation:**

```json theme={null}
{
  "overrides": {
    "signup_headline": { "value": "Join in seconds" }
  }
}
```

**Template code:**

```html theme={null}
<!-- signup.ejs -->
<div class="signup-container">
  <h1>
    <% if (experiment) { %>
      <%= experiment.config.signup_headline.value %>
    <% } else { %>
      Create your account
    <% } %>
  </h1>

	{%- auth0:widget -%}
</div>
```

Users assigned to the control variation see "Create your account." Users in the treatment see "Join in seconds." Users with no active experiment also see "Create your account" (the else branch).

## Example: conditional UI element

This example uses a boolean parameter to show or hide an additional UI element:

```html theme={null}
<!-- login.ejs -->
<% if (experiment && experiment.config.show_social_proof.value === true) { %>
  <div class="social-proof">
    <p>Join 2 million people who sign in with their passkey.</p>
  </div>
<% } %>

{%- auth0:widget -%}
```

The `=== true` comparison (rather than a truthy check) prevents the element from appearing when `experiment` is `null` or when the parameter is absent.

## Safe defaults when no experiment is active

When no experiment is active, `experiment` is `null` in the template context. Structure your templates to always render correctly without experiment context:

```html theme={null}
<h1>
  <%= (experiment && experiment.config.page_title && experiment.config.page_title.value)
      || "Default page title" %>
</h1>
```

Or use explicit if/else blocks (more readable for complex conditions):

```html theme={null}
<% if (experiment && experiment.config.page_title) { %>
  <h1><%= experiment.config.page_title.value %></h1>
<% } else { %>
  <h1>Default page title</h1>
<% } %>
```

Hardcode the fallback values in your templates. They match the control variation's baseline, so your templates behave correctly both when no experiment is running and when the control variation is assigned.
