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

# Unity API reference

Every public member of the `com.appstack.unity-sdk` UPM package. For installation
and integration guidance, see the [Unity SDK guide](/SDKs/unity).

Current stable release: **1.6.0**, published 16 September 2026. See the [changelog](/changelog/unity) for everything that changed.

## AppstackSDK

A static class in the `Appstack.Unity` namespace. Calls are synchronous unless noted;
[`DeleteUserData()`](#deleteuserdata) returns a `Task` and
[`GetAttributionParams()`](#getattributionparams) is callback-based.

```csharp theme={null}
using Appstack.Unity;
```

<Note>
  Every method logs and rethrows on failure, so wrap calls in a `try`/`catch` if a
  native error should not propagate into your game loop.
</Note>

### Configure()

```csharp theme={null}
public static void Configure(
    string apiKey,
    int logLevel = 1,
    string customerUserId = null)
```

Starts the SDK. Must be called before any other SDK method.

<ParamField path="apiKey" type="string" required>
  Your app's Appstack API key, from the dashboard under app settings.
</ParamField>

<ParamField path="logLevel" type="int" default="1">
  Console verbosity, descending: `0` DEBUG, `1` INFO, `2` WARN, `3` ERROR. iOS has
  no dedicated WARN tier, so `2` behaves like `3` there.
</ParamField>

<ParamField path="customerUserId" type="string" default="null">
  Your identifier for the signed-in user, when known at startup.
</ParamField>

```csharp theme={null}
AppstackSDK.Configure("your_api_key");

AppstackSDK.Configure("your_api_key", logLevel: 0, customerUserId: "user_123");
```

### SetCustomerUserId()

```csharp theme={null}
public static void SetCustomerUserId(string customerUserId)
```

Sets the customer user ID after `Configure()`, for example once a login reveals it.
A repeat `Configure()` is a no-op, so it cannot be used to change the ID. Safe to
call at any time; last write wins.

<ParamField path="customerUserId" type="string" required>
  Your identifier for the signed-in user. Set it as soon as it is known, and at
  least one event has to follow for it to take effect.
</ParamField>

```csharp theme={null}
AppstackSDK.SetCustomerUserId("user_123");
```

### SendEvent()

```csharp theme={null}
public static void SendEvent(
    EventType eventType,
    string eventName = null,
    Dictionary<string, object> parameters = null)
```

Sends an event.

Throws `ArgumentException` when `eventType` is `CUSTOM` and `eventName` is missing,
or when a parameter value cannot be represented as JSON.

<ParamField path="eventType" type="EventType" required>
  The event to send. See [EventType](#eventtype).
</ParamField>

<ParamField path="eventName" type="string" default="null">
  The event name. Required for `EventType.CUSTOM`, ignored for standard events.
</ParamField>

<ParamField path="parameters" type="Dictionary<string, object>" default="null">
  JSON-compatible parameters. Supports strings, booleans, finite numbers, nulls,
  nested string-keyed dictionaries, and arrays. For revenue events send `revenue`
  and `currency`.
</ParamField>

```csharp theme={null}
AppstackSDK.SendEvent(EventType.LOGIN);

AppstackSDK.SendEvent(EventType.PURCHASE, parameters: new Dictionary<string, object>
{
    { "revenue", 29.99 },
    { "currency", "USD" },
});

AppstackSDK.SendEvent(EventType.CUSTOM, "onboarding_finished");
```

### GetAppstackId()

```csharp theme={null}
public static string GetAppstackId()
```

Returns the Appstack ID for the current install.

<ResponseField name="returns" type="string">
  The install's Appstack ID.
</ResponseField>

### IsSdkDisabled()

```csharp theme={null}
public static bool IsSdkDisabled()
```

Whether the SDK is disabled, for example because the API key is invalid.

<ResponseField name="returns" type="bool">
  `true` when the SDK is disabled.
</ResponseField>

### GetAttributionParams()

```csharp theme={null}
public static void GetAttributionParams(
    Action<Dictionary<string, object>> onSuccess,
    Action<string> onError = null)
```

Fetches attribution parameters asynchronously, via callbacks. Exactly one of
`onSuccess` or `onError` fires.

Throws `ArgumentNullException` when `onSuccess` is `null`.

<ParamField path="onSuccess" type="Action<Dictionary<string, object>>" required>
  Called with the attribution parameters.
</ParamField>

<ParamField path="onError" type="Action<string>" default="null">
  Called with an error message if the request fails.
</ParamField>

```csharp theme={null}
AppstackSDK.GetAttributionParams(
    onSuccess: parameters => Debug.Log($"Attribution: {parameters.Count} params"),
    onError: error => Debug.LogError(error)
);
```

On iOS, `onSuccess` receives the reserved `appstack_match_status` key alongside the
attribution parameters, so an organic install, a skipped match, and a failed request
can be told apart rather than all arriving as an empty result. Android does not
report the key yet.

| Value               | Meaning                                                                                                                                                                    |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `matched`           | The install is attributed and parameters are present.                                                                                                                      |
| `matched_no_params` | A click matched, but the link carried no recognised tracking parameters.                                                                                                   |
| `organic`           | Confirmed no attribution.                                                                                                                                                  |
| `skipped`           | No match was attempted for this launch. Terminal for the life of the install.                                                                                              |
| `failed`            | Attempted but unresolved (offline, timeout, or a server error). Retried in-session and next launch, so re-read rather than assuming organic.                               |
| `not_configured`    | Read before `configure()` completed, or the SDK is disabled. A disabled SDK never resolves, so re-reading only helps when the read happened before `configure()` finished. |

### HandleUniversalLink()

```csharp theme={null}
public static AppstackLinkResult HandleUniversalLink(
    string url,
    string[] allowedHosts = null)
```

Parses an Appstack standard Universal Link or App Link delivered by
`Application.absoluteURL` or `Application.deepLinkActivated`. Safe to call before
`Configure()`.

Throws `ArgumentException` when `url` is empty or `allowedHosts` contains a blank
hostname.

<ParamField path="url" type="string" required>
  The tapped link.
</ParamField>

<ParamField path="allowedHosts" type="string[]" default="null">
  Hosts to accept. Omit to accept any host.
</ParamField>

<ResponseField name="returns" type="AppstackLinkResult">
  The parsed link, or `null` when the URL is not a recognised Appstack link.
</ResponseField>

```csharp theme={null}
void Awake()
{
    Application.deepLinkActivated += OnDeepLink;
    if (!string.IsNullOrEmpty(Application.absoluteURL))
        OnDeepLink(Application.absoluteURL);
}

void OnDeepLink(string url)
{
    var link = AppstackSDK.HandleUniversalLink(url);
    if (link != null) Route(link.DeeplinkId, link.QueryParams);
}
```

### EnableAppleAdsAttribution()

```csharp theme={null}
public static void EnableAppleAdsAttribution()
```

Starts Apple Search Ads attribution. iOS only, and a no-op on Android.

### DeleteUserData()

```csharp theme={null}
public static Task DeleteUserData()
```

Permanently deletes this install's Appstack data, for GDPR and privacy requests. The
task completes after the native request finishes.

<ResponseField name="returns" type="Task">
  Completes when deletion finishes.
</ResponseField>

```csharp theme={null}
await AppstackSDK.DeleteUserData();
```

## Types

### AppstackLinkResult

```csharp theme={null}
public sealed class AppstackLinkResult
{
    public string DeeplinkId { get; }
    public Dictionary<string, string> QueryParams { get; }
    public string Url { get; }
}
```

A tapped link, parsed entirely from the URL. Properties are read-only to callers.

<ResponseField name="DeeplinkId" type="string">
  The Appstack deep link ID.
</ResponseField>

<ResponseField name="QueryParams" type="Dictionary<string, string>">
  Query parameters parsed off the tapped URL.
</ResponseField>

<ResponseField name="Url" type="string">
  The URL that was handled.
</ResponseField>

### EventType

```csharp theme={null}
public enum EventType
```

Standard attribution events. Values follow the SNAKE\_CASE convention used by mobile
measurement partners. Where two names are synonymous, both are provided for
compatibility with existing integrations.

| Group        | Cases                                                                                         |
| ------------ | --------------------------------------------------------------------------------------------- |
| Lifecycle    | `INSTALL`                                                                                     |
| Auth         | `LOGIN`, `SIGN_UP`, `REGISTER`                                                                |
| Monetization | `PURCHASE`, `ADD_TO_CART`, `ADD_TO_WISHLIST`, `INITIATE_CHECKOUT`, `START_TRIAL`, `SUBSCRIBE` |
| Games        | `LEVEL_START`, `LEVEL_COMPLETE`                                                               |
| Engagement   | `TUTORIAL_COMPLETE`, `SEARCH`, `VIEW_ITEM`, `VIEW_CONTENT`, `SHARE`                           |
| Catch-all    | `CUSTOM`                                                                                      |

<Note>
  `INSTALL` is tracked by the SDK itself. You do not need to send it.
</Note>
