Class Events
Namespace: Unity.Services.Analytics
Syntax
[Obsolete("The interface provided by this static class has moved to AnalyticsService.Instance, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static class Events
Fields
PrivacyUrl
This is the URL for the Unity Analytics privacy policy. This policy page should be presented to the user in a platform-appropriate way along with the ability to opt out of data collection.
Declaration
[Obsolete("The interface provided by this field has moved to AnalyticsService.Instance.PrivacyUrl, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static readonly string PrivacyUrl
Field Value
Type | Description |
---|---|
String |
Methods
AdImpression(Events.AdImpressionArgs)
Record an Ad Impression event.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.AdImpression, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static void AdImpression(Events.AdImpressionArgs args)
Parameters
Type | Name | Description |
---|---|---|
Events.AdImpressionArgs | args | (Required) Helper object to handle arguments. |
CheckForRequiredConsents()
Returns identifiers of required consents we need to gather from the user
in order to be allowed to sent analytics events.
This method must be called every time the game starts - without checking the geolocation,
no event will be sent (even if the consent was already given).
If the required consent was already given, an empty list is returned.
If the user already opted out from the current legislation, an empty list is returned.
It involves the GeoIP call.
ConsentCheckException
is thrown if the GeoIP call was unsuccessful.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.CheckForRequiredConsents, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static async Task<List<string>> CheckForRequiredConsents()
Returns
Type | Description |
---|---|
Task<List<String>> | A list of consent identifiers that are required for sending analytics events. |
Exceptions
Type | Condition |
---|---|
ConsentCheckException | Thrown if the GeoIP call was unsuccessful. |
CustomData(String, IDictionary<String, Object>)
Record a custom event. A schema for this event must exist on the dashboard or it will be ignored.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.CustomData, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static void CustomData(string eventName, IDictionary<string, object> eventParams)
Parameters
Type | Name | Description |
---|---|---|
String | eventName | |
IDictionary<String, Object> | eventParams |
Flush()
Forces an immediately upload of all recorded events to the server, if there is an internet connection.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.Flush, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static void Flush()
Exceptions
Type | Condition |
---|---|
ConsentCheckException | Thrown if the required consent flow cannot be determined.. |
OptOut()
Opts the user out of sending analytics from all legislations.
To deny consent for a specific opt-in legislation, like PIPL, use ProvideConsent(string key, bool consent)
method)
All existing cached events and any subsequent events will be discarded immediately.
A final 'forget me' signal will be uploaded which will trigger purge of analytics data for this user from the back-end.
If this 'forget me' event cannot be uploaded immediately (e.g. due to network outage), it will be reattempted regularly
until successful upload is confirmed.
Consent status is stored in PlayerPrefs so that the opted-out status is maintained over app restart.
This action cannot be undone.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.OptOut, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static void OptOut()
Exceptions
Type | Condition |
---|---|
ConsentCheckException | Thrown if the required consent flow cannot be determined.. |
ProvideOptInConsent(String, Boolean)
Sets the consent status for the specified opt-in-based legislation (PIPL etc).
The required legislation identifier can be found by calling CheckForRequiredConsents
method.
If this method is tried to be used for the incorrect legislation (PIPL outside China etc),
the ConsentCheckException
is thrown.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.ProvideOptInConsent, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static void ProvideOptInConsent(string identifier, bool consent)
Parameters
Type | Name | Description |
---|---|---|
String | identifier | The legislation identifier for which the consent status should be changed. |
Boolean | consent | The consent status which should be set for the specified legislation. |
Exceptions
Type | Condition |
---|---|
ConsentCheckException | Thrown if the incorrect legislation was being provided or the required consent flow cannot be determined. |
Transaction(Events.TransactionParameters)
Record a Transaction event.
Declaration
[Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.Transaction, and should be accessed from there instead. This API will be removed in an upcoming release.")]
public static void Transaction(Events.TransactionParameters transactionParameters)
Parameters
Type | Name | Description |
---|---|---|
Events.TransactionParameters | transactionParameters | (Required) Helper object to handle parameters. |