Class AnalyticsHandler
Handles Analytics related API requests. When wishing to start a session or add content, refer to this handler. This handler will also manage analytics submission based on the application life cycle.
Inherited Members
Namespace: Appearition.Analytics
Assembly: Appearition.SDK.dll
Syntax
public sealed class AnalyticsHandler : BaseHandler
Properties
View SourceOngoingSession
Contains the current ongoing session, if any. In order to start a new session, call BeginSession. This variable will automatically be populated from the outcome. The session will be stored locally, and will by synced with the EMS when available. If a user logs out, you should end the session to sync the content back to the EMS. If the application closes, the content will automatically be synced next time the application is turned on using existing content.
Declaration
public static Session OngoingSession { get; }
Property Value
Type | Description |
---|---|
Session |
Methods
View SourceAddActivityToCurrentSession(Activity)
Add a given activity to the current session. Ensures that it is properly set up and part of the session, but does not sync it with the EMS. Once the activity is considered complete, submit it using SubmitActivityToCurrentSession.
Declaration
public static Session AddActivityToCurrentSession(Activity activity)
Parameters
Type | Name | Description |
---|---|---|
Activity | activity |
Returns
Type | Description |
---|---|
Session |
BeginSession()
Begin a new Analytics Session. If any session was ongoing, it will be handled and closed.
Declaration
public static Session BeginSession()
Returns
Type | Description |
---|---|
Session |
BeginSession(String, Int32)
Begin a new Analytics Session. If any session was ongoing, it will be handled and closed.
Declaration
public static Session BeginSession(string tenantKey, int channelId)
Parameters
Type | Name | Description |
---|---|---|
System.String | tenantKey | The target tenant to record this session against. |
System.Int32 | channelId | The target channel to record this session against. |
Returns
Type | Description |
---|---|
Session |
EndCurrentSession()
Finalizes an Analytics Session. While this process is optional, it ensures that the content on the EMS matches the local content, and that the end time of the session is recorded properly.
Declaration
public static void EndCurrentSession()
GetPathToSessionFile(String)
Generates the path to a Session storage file using a session key.
Declaration
public static string GetPathToSessionFile(string sessionKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | sessionKey |
Returns
Type | Description |
---|---|
System.String |
InitializeAnalytics()
Initializes the main analytics module. Ensures that any sessions leftovers are synced properly. By default, begins a new session. ///
Declaration
public static void InitializeAnalytics()
InitializeAnalytics(Boolean, Action<Session>)
Initializes the main analytics module. Ensures that any sessions leftovers are synced properly. Optionally, starts a new session as well.
Declaration
public static void InitializeAnalytics(bool shouldStartSession, Action<Session> onSessionStarted = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | shouldStartSession | |
System.Action<Session> | onSessionStarted |
InitializeAnalytics(String, Int32, Action<Session>)
Initializes the main analytics module. Ensures that any sessions leftovers are synced properly. Optionally, starts a new session as well. ///
Declaration
public static void InitializeAnalytics(string tenantKey, int channelId, Action<Session> onSessionStarted = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | tenantKey | |
System.Int32 | channelId | |
System.Action<Session> | onSessionStarted |
SubmitActivityToCurrentSession(Activity)
Finalizes an activity as part of the current session, and syncs it with the EMS.
Declaration
public static Session SubmitActivityToCurrentSession(Activity activity)
Parameters
Type | Name | Description |
---|---|---|
Activity | activity |
Returns
Type | Description |
---|---|
Session |
SyncPendingAnalytics()
Syncs the current local data with the EMS. If a sync process is currently ongoing, waits for it to be complete before starting it.
Declaration
public static void SyncPendingAnalytics()
SyncPendingAnalyticsProcessWhenAvailable()
Syncs the current local data with the EMS. If a sync process is currently ongoing, waits for it to be complete before starting it.
Declaration
public static IEnumerator SyncPendingAnalyticsProcessWhenAvailable()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
UpdateOngoingSessionLocalSave()
Updates the local content of this current session using the content of the OnGoing session. This steps ensures that the content is not lost.
Declaration
public static void UpdateOngoingSessionLocalSave()