Code Reference

Initialization

These steps are for advanced users who want to more closely integrate our API calls with their projects.

Make sure you have entered your API and Developer keys in the CognitiveVR Preferences from the Unreal Project Settings!

Sessions

A Session Custom Event should begin from your main menu or at the start of the "main" portion of your project.

Begin a session
//IAnalyticsProvider
TSharedPtr<IAnalyticsProvider> analytics = FAnalytics::Get().GetDefaultConfiguredProvider();
analytics.Get()->StartSession();
//FAnalyticsProviderCognitiveVR
TSharedPtr<FAnalyticsProviderCognitiveVR> cognitive = FAnalyticsCognitiveVR::Get().GetCognitiveVRProvider();
TArray<FAnalyticsEventAttribute> attributes;
cognitive.Get()->StartSession(attributes);
End a session
//IAnalyticsProvider
TSharedPtr<IAnalyticsProvider> analytics = FAnalytics::Get().GetDefaultConfiguredProvider();
analytics.Get()->EndSession();
//FAnalyticsProviderCognitiveVR
TSharedPtr<FAnalyticsProviderCognitiveVR> cognitive = FAnalyticsCognitiveVR::Get().GetCognitiveVRProvider();
cognitive.Get()->EndSession();

User Info

This can be used to track a user across multiple devices. You should manage unique ids for your users.

//IAnalyticsProvider
TSharedPtr<IAnalyticsProvider> analytics = FAnalytics::Get().GetDefaultConfiguredProvider();
analytics->SetUserID("UniqueUserID");
analytics->SetGender("Male");
analytics->SetAge(20);
//FAnalyticsProviderCognitiveVR
TSharedPtr<FAnalyticsProviderCognitiveVR> cognitive = FAnalyticsCognitiveVR::Get().GetCognitiveVRProvider();
cognitive->SetUserID("UniqueUserID");
cognitive->SetGender("Male");
cognitive->SetAge(20);
cognitive->SetUserProperty("Height", 180);

Device Info

This is sent automatically when the session is started.

Custom Events

For an explanation about custom events, refer to the Custom Events page.