{
  "version": "0.0.4",
  "policy": {
    "canonicalOnly": true,
    "canonicalObjects": [
      "user",
      "account",
      "session",
      "page",
      "onboarding",
      "activation",
      "feature",
      "trial",
      "plan",
      "checkout",
      "subscription",
      "experiment",
      "error",
      "support"
    ],
    "canonicalEventsCarryNoPii": true,
    "targetMetricsMustBeCanonical": true
  },
  "enums": {
    "eventSources": [
      "client",
      "server"
    ],
    "featureRoles": [
      "activation",
      "core",
      "growth",
      "monetisation",
      "retention",
      "other"
    ],
    "currencies": [
      "USD",
      "EUR",
      "GBP",
      "JPY",
      "CAD",
      "AUD",
      "CHF",
      "CNY",
      "SEK",
      "NZD",
      "MXN",
      "SGD",
      "HKD",
      "NOK",
      "KRW",
      "TRY",
      "RUB",
      "INR",
      "BRL",
      "ZAR",
      "DKK",
      "PLN",
      "TWD",
      "THB",
      "MYR",
      "IDR",
      "PHP",
      "CZK",
      "HUF",
      "ILS",
      "CLP",
      "AED",
      "COP",
      "SAR",
      "VND",
      "ARS",
      "EGP"
    ],
    "intervals": [
      "one_time",
      "monthly",
      "quarterly",
      "annually"
    ],
    "deviceTypes": [
      "desktop",
      "mobile",
      "tablet",
      "server"
    ],
    "lifecycleStages": [
      "anonymous",
      "signed_up",
      "activated",
      "paying",
      "churned"
    ]
  },
  "contextProperties": {
    "arial_event_id": {
      "type": "string",
      "optional": false,
      "nullable": false,
      "format": "uuid"
    },
    "arial_timestamp": {
      "type": "string",
      "optional": false,
      "nullable": false,
      "format": "datetime"
    },
    "arial_taxonomy_version": {
      "type": "string",
      "optional": false,
      "nullable": false
    },
    "arial_sdk_version": {
      "type": "string",
      "optional": false,
      "nullable": false
    },
    "arial_workspace_id": {
      "type": "string",
      "optional": false,
      "nullable": false
    },
    "user_id": {
      "type": "string",
      "optional": false,
      "nullable": true
    },
    "anonymous_id": {
      "type": "string",
      "optional": false,
      "nullable": false
    },
    "session_id": {
      "type": "string",
      "optional": false,
      "nullable": false
    },
    "account_id": {
      "type": "string",
      "optional": false,
      "nullable": true
    },
    "platform": {
      "type": "enum",
      "optional": false,
      "nullable": false,
      "values": [
        "web",
        "ios",
        "android",
        "server"
      ]
    },
    "device_type": {
      "type": "enum",
      "optional": true,
      "nullable": false,
      "values": [
        "desktop",
        "mobile",
        "tablet",
        "server"
      ]
    },
    "url": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "user_agent": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "referrer_domain": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "utm_source": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "utm_medium": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "utm_campaign": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "utm_term": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "utm_content": {
      "type": "string",
      "optional": true,
      "nullable": false
    },
    "experiment_assignments": {
      "type": "record",
      "optional": true,
      "nullable": false
    },
    "lifecycle_stage": {
      "type": "enum",
      "optional": true,
      "nullable": false,
      "values": [
        "anonymous",
        "signed_up",
        "activated",
        "paying",
        "churned"
      ]
    }
  },
  "events": [
    {
      "name": "user.signed_up",
      "description": "A new user created an account.",
      "sources": [
        "client",
        "server"
      ],
      "precedence": "server",
      "properties": {
        "method": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "google",
            "github",
            "email",
            "sso"
          ]
        },
        "referrer": {
          "type": "string",
          "optional": true,
          "nullable": false
        }
      }
    },
    {
      "name": "user.signed_in",
      "description": "An existing user authenticated.",
      "sources": [
        "client",
        "server"
      ],
      "precedence": "server",
      "properties": {
        "method": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "google",
            "github",
            "email",
            "sso"
          ]
        }
      }
    },
    {
      "name": "user.signed_out",
      "description": "A user ended their session intentionally.",
      "sources": [
        "client"
      ],
      "properties": {}
    },
    {
      "name": "user.invited",
      "description": "A workspace invite was sent. Carries invite_id, never email.",
      "sources": [
        "server"
      ],
      "properties": {
        "invite_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "role": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "owner",
            "admin",
            "member",
            "viewer"
          ]
        }
      }
    },
    {
      "name": "user.invite_accepted",
      "description": "An invited user accepted and joined a workspace.",
      "sources": [
        "server"
      ],
      "properties": {
        "invite_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        }
      }
    },
    {
      "name": "account.created",
      "description": "A new workspace / tenant account was created.",
      "sources": [
        "client",
        "server"
      ],
      "precedence": "server",
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": true,
          "nullable": false,
          "min": 1
        }
      }
    },
    {
      "name": "account.member_added",
      "description": "A user was added to an existing account.",
      "sources": [
        "server"
      ],
      "properties": {
        "added_user_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "role": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "owner",
            "admin",
            "member",
            "viewer"
          ]
        }
      }
    },
    {
      "name": "account.member_removed",
      "description": "A user was removed from an existing account.",
      "sources": [
        "server"
      ],
      "properties": {
        "removed_user_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        }
      }
    },
    {
      "name": "onboarding.step_completed",
      "description": "An ordered onboarding step was finished.",
      "sources": [
        "client"
      ],
      "properties": {
        "step_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "step_index": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "total_steps": {
          "type": "number",
          "optional": true,
          "nullable": false,
          "integer": true,
          "min": 0
        }
      }
    },
    {
      "name": "onboarding.completed",
      "description": "The full onboarding flow was finished.",
      "sources": [
        "client"
      ],
      "properties": {
        "total_steps": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "duration_ms": {
          "type": "number",
          "optional": true,
          "nullable": false,
          "integer": true,
          "min": 0
        }
      }
    },
    {
      "name": "onboarding.abandoned",
      "description": "Onboarding was exited before completion.",
      "sources": [
        "client"
      ],
      "properties": {
        "last_step_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "step_index": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        }
      }
    },
    {
      "name": "activation.reached",
      "description": "The workspace's declared 'aha' moment fired for this user.",
      "sources": [
        "client",
        "server"
      ],
      "precedence": "server",
      "properties": {
        "trigger_event": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        }
      }
    },
    {
      "name": "session.started",
      "description": "A new user session began.",
      "sources": [
        "client"
      ],
      "properties": {}
    },
    {
      "name": "session.ended",
      "description": "A user session ended; carries duration and event count.",
      "sources": [
        "client"
      ],
      "properties": {
        "duration_ms": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "event_count": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        }
      }
    },
    {
      "name": "page.viewed",
      "description": "A page or screen was viewed.",
      "sources": [
        "client"
      ],
      "properties": {
        "path": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "title": {
          "type": "string",
          "optional": true,
          "nullable": false
        },
        "referrer": {
          "type": "string",
          "optional": true,
          "nullable": false
        }
      }
    },
    {
      "name": "feature.used",
      "description": "A product feature was used. feature_id is a stable, workspace-local identifier the agent chooses; feature_role classifies the feature for cross-workspace comparison.",
      "sources": [
        "client"
      ],
      "properties": {
        "feature_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "feature_role": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "activation",
            "core",
            "growth",
            "monetisation",
            "retention",
            "other"
          ]
        },
        "outcome": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "success",
            "error",
            "abandoned"
          ]
        }
      }
    },
    {
      "name": "feature.first_used",
      "description": "A user used a product feature for the first time. Same id/role shape as feature.used.",
      "sources": [
        "client"
      ],
      "properties": {
        "feature_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "feature_role": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "activation",
            "core",
            "growth",
            "monetisation",
            "retention",
            "other"
          ]
        }
      }
    },
    {
      "name": "trial.started",
      "description": "A trial subscription began.",
      "sources": [
        "server"
      ],
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "trial_duration_days": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        }
      }
    },
    {
      "name": "trial.ended",
      "description": "A trial ended; outcome distinguishes converted vs expired vs canceled.",
      "sources": [
        "server"
      ],
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "outcome": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "converted",
            "expired",
            "canceled"
          ]
        }
      }
    },
    {
      "name": "plan.viewed",
      "description": "Pricing or upgrade surface was viewed. Use surface to identify which.",
      "sources": [
        "client"
      ],
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": true,
          "nullable": false,
          "min": 1
        },
        "surface": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "pricing_page",
            "upgrade_modal",
            "billing_settings",
            "other"
          ]
        }
      }
    },
    {
      "name": "checkout.started",
      "description": "A user opened the checkout flow.",
      "sources": [
        "client"
      ],
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "amount_native_minor": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "currency": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CAD",
            "AUD",
            "CHF",
            "CNY",
            "SEK",
            "NZD",
            "MXN",
            "SGD",
            "HKD",
            "NOK",
            "KRW",
            "TRY",
            "RUB",
            "INR",
            "BRL",
            "ZAR",
            "DKK",
            "PLN",
            "TWD",
            "THB",
            "MYR",
            "IDR",
            "PHP",
            "CZK",
            "HUF",
            "ILS",
            "CLP",
            "AED",
            "COP",
            "SAR",
            "VND",
            "ARS",
            "EGP"
          ]
        },
        "interval": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "one_time",
            "monthly",
            "quarterly",
            "annually"
          ]
        }
      }
    },
    {
      "name": "checkout.completed",
      "description": "Server-confirmed purchase. Carries native amount + currency + interval.",
      "sources": [
        "server"
      ],
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "amount_native_minor": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "currency": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CAD",
            "AUD",
            "CHF",
            "CNY",
            "SEK",
            "NZD",
            "MXN",
            "SGD",
            "HKD",
            "NOK",
            "KRW",
            "TRY",
            "RUB",
            "INR",
            "BRL",
            "ZAR",
            "DKK",
            "PLN",
            "TWD",
            "THB",
            "MYR",
            "IDR",
            "PHP",
            "CZK",
            "HUF",
            "ILS",
            "CLP",
            "AED",
            "COP",
            "SAR",
            "VND",
            "ARS",
            "EGP"
          ]
        },
        "interval": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "one_time",
            "monthly",
            "quarterly",
            "annually"
          ]
        },
        "payment_provider": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "stripe",
            "paddle",
            "chargebee",
            "other"
          ]
        },
        "provider_customer_id": {
          "type": "string",
          "optional": true,
          "nullable": false,
          "min": 1
        }
      }
    },
    {
      "name": "checkout.abandoned",
      "description": "Checkout was exited before completion. Records the last step reached.",
      "sources": [
        "client"
      ],
      "properties": {
        "plan_id": {
          "type": "string",
          "optional": true,
          "nullable": false,
          "min": 1
        },
        "step": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "plan_selection",
            "billing_details",
            "payment",
            "confirmation"
          ]
        }
      }
    },
    {
      "name": "subscription.created",
      "description": "A new paid subscription was created.",
      "sources": [
        "server"
      ],
      "properties": {
        "subscription_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "amount_native_minor": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "currency": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CAD",
            "AUD",
            "CHF",
            "CNY",
            "SEK",
            "NZD",
            "MXN",
            "SGD",
            "HKD",
            "NOK",
            "KRW",
            "TRY",
            "RUB",
            "INR",
            "BRL",
            "ZAR",
            "DKK",
            "PLN",
            "TWD",
            "THB",
            "MYR",
            "IDR",
            "PHP",
            "CZK",
            "HUF",
            "ILS",
            "CLP",
            "AED",
            "COP",
            "SAR",
            "VND",
            "ARS",
            "EGP"
          ]
        },
        "interval": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "one_time",
            "monthly",
            "quarterly",
            "annually"
          ]
        }
      }
    },
    {
      "name": "subscription.upgraded",
      "description": "A subscription moved to a higher-priced plan. Records previous and new plan ids.",
      "sources": [
        "server"
      ],
      "properties": {
        "subscription_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "previous_plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "new_plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "amount_native_minor_delta": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true
        },
        "currency": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CAD",
            "AUD",
            "CHF",
            "CNY",
            "SEK",
            "NZD",
            "MXN",
            "SGD",
            "HKD",
            "NOK",
            "KRW",
            "TRY",
            "RUB",
            "INR",
            "BRL",
            "ZAR",
            "DKK",
            "PLN",
            "TWD",
            "THB",
            "MYR",
            "IDR",
            "PHP",
            "CZK",
            "HUF",
            "ILS",
            "CLP",
            "AED",
            "COP",
            "SAR",
            "VND",
            "ARS",
            "EGP"
          ]
        }
      }
    },
    {
      "name": "subscription.downgraded",
      "description": "A subscription moved to a lower-priced plan. Records previous and new plan ids.",
      "sources": [
        "server"
      ],
      "properties": {
        "subscription_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "previous_plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "new_plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "amount_native_minor_delta": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true
        },
        "currency": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CAD",
            "AUD",
            "CHF",
            "CNY",
            "SEK",
            "NZD",
            "MXN",
            "SGD",
            "HKD",
            "NOK",
            "KRW",
            "TRY",
            "RUB",
            "INR",
            "BRL",
            "ZAR",
            "DKK",
            "PLN",
            "TWD",
            "THB",
            "MYR",
            "IDR",
            "PHP",
            "CZK",
            "HUF",
            "ILS",
            "CLP",
            "AED",
            "COP",
            "SAR",
            "VND",
            "ARS",
            "EGP"
          ]
        }
      }
    },
    {
      "name": "subscription.canceled",
      "description": "A subscription was canceled. Records reason and effective date.",
      "sources": [
        "server"
      ],
      "properties": {
        "subscription_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "reason": {
          "type": "enum",
          "optional": true,
          "nullable": false,
          "values": [
            "user_initiated",
            "payment_failed",
            "admin",
            "other"
          ]
        },
        "effective_at": {
          "type": "string",
          "optional": true,
          "nullable": false,
          "format": "datetime"
        }
      }
    },
    {
      "name": "subscription.renewed",
      "description": "A recurring billing period renewed successfully.",
      "sources": [
        "server"
      ],
      "properties": {
        "subscription_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "plan_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "amount_native_minor": {
          "type": "number",
          "optional": false,
          "nullable": false,
          "integer": true,
          "min": 0
        },
        "currency": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "USD",
            "EUR",
            "GBP",
            "JPY",
            "CAD",
            "AUD",
            "CHF",
            "CNY",
            "SEK",
            "NZD",
            "MXN",
            "SGD",
            "HKD",
            "NOK",
            "KRW",
            "TRY",
            "RUB",
            "INR",
            "BRL",
            "ZAR",
            "DKK",
            "PLN",
            "TWD",
            "THB",
            "MYR",
            "IDR",
            "PHP",
            "CZK",
            "HUF",
            "ILS",
            "CLP",
            "AED",
            "COP",
            "SAR",
            "VND",
            "ARS",
            "EGP"
          ]
        },
        "interval": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "one_time",
            "monthly",
            "quarterly",
            "annually"
          ]
        }
      }
    },
    {
      "name": "experiment.exposed",
      "description": "A user was exposed to a variant of an experiment. The conversion outcome is derived at readout time by checking whether the experiment's canonical target metric fired for the same actor within the conversion window — there is no separate experiment.converted event.",
      "sources": [
        "client",
        "server"
      ],
      "precedence": "client",
      "properties": {
        "experiment_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        },
        "variant_id": {
          "type": "string",
          "optional": false,
          "nullable": false,
          "min": 1
        }
      }
    },
    {
      "name": "error.encountered",
      "description": "A user-facing error was observed. message is workspace-local; never PII.",
      "sources": [
        "client",
        "server"
      ],
      "properties": {
        "surface": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "client",
            "server",
            "integration"
          ]
        },
        "severity": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "debug",
            "info",
            "warning",
            "error",
            "critical"
          ]
        },
        "error_code": {
          "type": "string",
          "optional": true,
          "nullable": false
        },
        "message": {
          "type": "string",
          "optional": true,
          "nullable": false
        }
      }
    },
    {
      "name": "support.contacted",
      "description": "A user contacted support via any channel.",
      "sources": [
        "client"
      ],
      "properties": {
        "channel": {
          "type": "enum",
          "optional": false,
          "nullable": false,
          "values": [
            "chat",
            "email",
            "phone",
            "form",
            "other"
          ]
        },
        "topic": {
          "type": "string",
          "optional": true,
          "nullable": false
        }
      }
    }
  ]
}