# Product Documentation : Unreal Engine SDK Import Integration You can start sending the data from your Unreal Engine app to Arm Treasure Data, using our Unreal Engine SDK. Visit the following repository for more information. div img # Requirements - Unreal Engine 4.14 - Treasure Data Write-Only API Key (Select **User** > **API Keys**) # Getting Started The following document assumes that the current Unreal Engine has been compiled from sources or it has all dependencies so third-party plugins can be built. ## Download and Place the Plugin Get a copy of the plugin from the main GIT repository: ```bash $ git clone http://github.com/treasure-data/td-ue4-sdk ``` Copy the new **td-ue4-sdk** to your Engine plugins folder, the target path as follows: ```bash UnrealEngine/Engine/Plugins/td-ue4-sdk ``` > Alternatively, you can copy the plugin content inside your Project Plugin directory, not that this approach don't work on Linux Development environment. ## Build the Plugin To build the plugin is required to generate the build-rules, for the purpose the UE4 Engine provides a script called **GenerateProjectFiles**: - GenerateProjectFiles.bat - GenerateProjectFiles.sh Depending on the system (Unix bases or Window), run the proper script from the command line: - If the plugin is inside the Project directory (Project/Plugins), go to the Project root directory and run the script. - If the plugin is inside the Engine, run the command from the Unreal Engine source root directory. When the command finishes, type the `make` command: ```bash $ make ``` After a few seconds, the plugin binary is available. ### Speed Up Plugin Build Phase In some cases is required to re-build only the plugin, using a normal make command can take some minutes as it does some parsing running some scripts to fix dependencies, to speed up the process the following options can be added: ```bash $ make UE4Editor ARGS=-canskiplink ``` ## Enable the Analytics Plugins for Your Project Inside the Unreal Engine 4 Editor, open your project and the *plugins* window: - **Edit** > **Plugins** Now enable the two required plugins: - Blueprints: located at **Built-in** > **Analytics** - Treasure Data: located at **Installed** > **Analytics** ![TD Analytics Provider](/assets/unreal_engine_2.e875bb135690fd2f3b7339c0cd0e4568b240fcc5e02a7b545b7b7ce335acd27f.55b3fb9e.png) ![Analytics Blueprint Library](/assets/unreal_engine_3.04c0a1c88e21f778ca2f3f12deb9b7dda5aef4be90d00e093d79bf8140a6a69c.55b3fb9e.png) ## Configure Project Settings From your project directory, open and edit the file *Config/DefaultEngine.ini* and append the following content at the bottom: ```toml [Analytics] ProviderModuleName=TreasureData TDApiKey=TD-WRITE-ONLY-KEY TDDatabase=DATABASE_NAME SendInterval=10 [AnalyticsDevelopment] ProviderModuleName=TreasureData TDApiKey=TD-WRITE-ONLY-KEY TDDatabase=DATABASE_NAME SendInterval=10 [AnalyticsTest] ProviderModuleName=TreasureData TDApiKey=TD-WRITE-ONLY-KEY TDDatabase=DATABASE_NAME SendInterval=10 ``` Save the file and restart Unreal Engine Editor. ## Gather Metrics Through Blueprints In the Editor, select the Blueprints drop-down menu and select the *Open Level Blueprint* option: ![Open Level Blueprint](/assets/unreal_engine_4.9d461ee1e0ca170e5bdcd1fad31d94e8b480e6ff7e2f9dc571eeb683654c0afd.55b3fb9e.png) Now in the Event graphs, different events can be connected to Analytics functions, as an example, the following image demonstrates how to track the *Session Start*, *Session End*, and *Record Event w/Attributes* events: After a Game starts, the plugin will send the events to Treasure Data. # Treasure Data To query the game events, go to the TD Console, select **Databases**, and open the database used in the game (Config/DefaultEngine.ini > TDDatabase): ![Databases](/assets/unreal_engine_5.68894ea5600fcd87f1b9b58b4b4eedd49b67340b345f145f6364bf863da63216.55b3fb9e.png) By default two tables are created: - Sessions: start and stop sessions - Events: All events with or without attributes. To query records select a table name and select the *Query* button. By default you can issue a SQL query as in the following example: ```sql SELECT * from events; ``` ![Query](/assets/unreal_engine_6.288a17cc36c93cdf37fdf93b5516ad7d925db66ece47cb957ad8331afbb09386.55b3fb9e.png)