Class AnalyticsApi
Represents a collection of functions to interact with the API endpoints
Inherited Members
Namespace: Unity.Services.Apis.Analytics
Assembly: Unity.Services.Apis.dll
Syntax
public class AnalyticsApi : IAnalyticsApi, IApiAccessor
Constructors
AnalyticsApi(IApiClient)
Initializes a new instance of the Analytics
Declaration
public AnalyticsApi(IApiClient apiClient)
Parameters
Type | Name | Description |
---|---|---|
IApi |
apiClient | The client interface for synchronous API access. |
AnalyticsApi(IApiClient, IApiConfiguration)
Initializes a new instance of the Analytics
Declaration
public AnalyticsApi(IApiClient apiClient, IApiConfiguration apiConfiguration)
Parameters
Type | Name | Description |
---|---|---|
IApi |
apiClient | The client interface for synchronous API access. |
IApi |
apiConfiguration | The configuration object. |
Properties
Client
The client for accessing this underlying API asynchronously.
Declaration
public IApiClient Client { get; }
Property Value
Type | Description |
---|---|
IApi |
Configuration
Gets the configuration object
Declaration
public IApiConfiguration Configuration { get; }
Property Value
Type | Description |
---|---|
IApi |
An instance of the Configuration |
Methods
GenerateUuid(CancellationToken)
Generate a random unique userID Generates a random unique userID. Subsequent requests will return a different value. If you don’t have your own userID in your game, generating a Universally Unique Identifier (UUID) is the recommended way to create one. You’ll need to store the returned value locally on the client and reuse it for all future Collect calls from that specific client.
Declaration
public ApiOperation<UuidResponse> GenerateUuid(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |
GetBasePath()
Gets the base path of the API client.
Declaration
public string GetBasePath()
Returns
Type | Description |
---|---|
string | The base path |
SubmitEvent(string, string, string, string, SubmitEventRequest, CancellationToken)
Submit event(s) You may submit either a single event or a list of events to this endpoint. When possible, sending a list of events is preferable due to efficiencies in connection pooling. Keep the POST length below 5MB; anything above might be rejected.
Declaration
public ApiOperation SubmitEvent(string projectId, string environmentName, string PIPL_CONSENT = null, string PIPL_EXPORT = null, SubmitEventRequest submitEventRequest = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | projectId | ID for Unity project |
string | environmentName | Name of an environment. To get the Environment name, go to the project Dashboard > Projects > Project Settings > Environments. |
string | PIPL_CONSENT | The presence of this header will indicate the player has granted consent to data collection. Players who do not consent should not have this header set on requests. The value of the header does not matter. This header is only required if the request originates in China. (optional) |
string | PIPL_EXPORT | The presence of this header will indicate the player has granted consent to their data being sent out of China for processing. Players who do not consent should not have this header set on requests. The value of the header does not matter. This header is only required if the request originates in China. (optional) |
Submit |
submitEventRequest | (optional) |
Cancellation |
cancellationToken | Cancellation Token to cancel the request. |
Returns
Type | Description |
---|---|
Api |
The operation |