Integration Documentation (Unreal Engine)
|
Collect
Compatibility
- Unreal Engineversion 4.26 and above
Currently supports Android, iOS, Windows, and macOS platforms
1. Integrate SensorsAnalytics Plugin
- From GitHub get Unreal Engine SDK
- Put the SensorsAnalytics directory into the Plugins directory of your project (if the Plugins directory does not exist, it needs to be created)
1.1. Plugin dependencies for Windows platforms(v0.0.3 previous version)
You can directly try to use the pre-compiled dependency files provided by us, or compile them yourself.
1.1.1. Use our pre-compiled zlib
We have compiled zlib for Windows 10 (x64) with Visual Studio 2019 and bundled it with the SDK. The directory is as follows: SensorsAnalytics → Source → ThirdParty → Windows → zlib_x64.
Also, SensorsAnalytics → SensorsAnalytics.Build.cs has been modified:
if(Target.Platform == UnrealTargetPlatform.Win64) { // add header PublicIncludePaths.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../ThirdParty/Windows/zlib_x64/Include"))); // add lib PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "../ThirdParty/Windows/zlib_x64/lib/libz-static.lib")); }
Higher versions of Visual Studio can also import and use this pre-compiled library.
1.1.2. Compile zlib yourself
- From zlib Official websitedownload zlib Source code
- Compile according to the platform needed (win64 or win32)
- Put the compiled result into the SDK
- Modify the SensorsAnalytics → SensorsAnalytics.Build.cs file to import the compiled library and header files
2. Enable SensorsAnalytics Plugin
Integrate SensorsAnalytics After the plugin, you need to do the following to enable it:
- Enable Unreal Editor
- Open Edit → Plugins and enable SensorsAnalytics(In Analytics sort)
- If you use Blueprint and use built-in Analytics service, please enable Analytics Blueprint Library(in built-inAnalytics sort), You will be prompted to restart Unreal Editor
- After Restarting Unreal Editor , open Edit → Project Settings → Plugins, Settings SensorsAnalytics argument:
- Server Url:required: indicates the data receiving address
- Enable Log:Indicates whether to enable the log function. After this function is enabled, when the buried point event is triggered,即可Enable the log output function of the SDK
Flush Network Policy:Example Set a data reporting policy, Including 2G, 3G, 4G, 5G and WIFI, currently only support Android and iOS
- Flush Interval:Setthe interval between the last send and the unit is milliseconds. The default value is 15 x 1000 milliseconds
Flush Bulk Size:Set trigger data sendingThe number of event entries cached locally. The default number is 100
Auto Track Event Type:Full buried site type, includingWhether the startup event is triggered automatically($AppStart)andWhether the exit event is triggered automatically($AppEnd), Currently, only Android and iOS devices are supported.
If you use built-in Analytics service, need inConfig directory DefaultEngine.ini file add the following:
[Analytics] ProviderModuleName=SensorsAnalytics
CODEIf you want to use it directly in C++ code SensorsAnalytics interface, Needed in the project *.Build.cs file add the following:
PrivateDependencyModuleNames.AddRange(new string[] { "SensorsAnalytics" }); PrivateIncludePathModuleNames.AddRange(new string[] { "SensorsAnalytics" });
CODEIn addition, it needs to be referenced in the files that use the SDK SensorsAnalytics.h Header file:
#include "SensorsAnalytics.h"
CODE
3. Initialize SDK
If you need use SensorsAnalytics interface, should be initialized with the SDK first.
In Blueprint , Initialization can be done in one of the following ways:
- Call Analytics Blueprint LibraryStartSession interface
- Call SensorsAnalytics Start interface
In C++ code, initialization can be done with the following call:
USensorsAnalytics::Start();
Once initialization is complete, you can use the SDK to trigger events. It can be used here Analytics Blueprint Library provided RecordEvent interface, can also use USensorsAnalytics the interface provided.
Note: The content of this document is a technical document that provides details on how to use the Sensors product and does not include sales terms; the specific content of enterprise procurement products and technical services shall be subject to the commercial procurement contract.