docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class AnalyticsApi

    Represents a collection of functions to interact with the API endpoints

    Inheritance
    object
    AnalyticsApi
    Implements
    IAnalyticsApi
    IApiAccessor
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Services.Apis.Analytics
    Assembly: solution.dll
    Syntax
    public class AnalyticsApi : IAnalyticsApi, IApiAccessor

    Constructors

    AnalyticsApi(IApiClient)

    Initializes a new instance of the AnalyticsApi class using a Configuration object and client instance.

    Declaration
    public AnalyticsApi(IApiClient apiClient)
    Parameters
    Type Name Description
    IApiClient apiClient

    The client interface for synchronous API access.

    AnalyticsApi(IApiClient, IApiConfiguration)

    Initializes a new instance of the AnalyticsApi class using a Configuration object and client instance.

    Declaration
    public AnalyticsApi(IApiClient apiClient, IApiConfiguration apiConfiguration)
    Parameters
    Type Name Description
    IApiClient apiClient

    The client interface for synchronous API access.

    IApiConfiguration apiConfiguration

    The configuration object.

    Properties

    Client

    The client for accessing this underlying API asynchronously.

    Declaration
    public IApiClient Client { get; }
    Property Value
    Type Description
    IApiClient

    Configuration

    Gets the configuration object

    Declaration
    public IApiConfiguration Configuration { get; }
    Property Value
    Type Description
    IApiConfiguration

    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
    CancellationToken cancellationToken

    Cancellation Token to cancel the request.

    Returns
    Type Description
    ApiOperation<UuidResponse>

    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)

    SubmitEventRequest submitEventRequest

    (optional)

    CancellationToken cancellationToken

    Cancellation Token to cancel the request.

    Returns
    Type Description
    ApiOperation

    The operation

    Implements

    IAnalyticsApi
    IApiAccessor
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)