Skip to content

adjust/steamworks_unreal_sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

This is the Beta Adjust™ SDK for Unreal apps using Steamworks.

Integration guide for Unreal platform

This guide explains how to integrate the Adjust Steamworks Unreal SDK into any Unreal C++ project.

Prerequisites

  1. Unreal Engine 5.x
  2. OnlineSubsystemSteam configured and working.
  3. Steam client installed with an active user.

Add the Adjust SDK

  1. Copy the provided Adjust source folder Adjust into your game module Source tree.
YourGame/Source/YourGame/Adjust/
  Adjust.h
  Adjust.cpp
  AdjustAttributionData.h
  AdjustEvent.h
  AdjustEvent.cpp
  AdjustLogger.h
  AdjustLogger.cpp
  AdjustResponseData.h
  AdjustResponseData.cpp
  1. Update Module Dependencies

In YourGame.Build.cs, add required dependencies:

PublicDependencyModuleNames.AddRange(new string[] {
   "Core",
   "CoreUObject",
   "Engine",
   "HTTP",
   "Json",
   "JsonUtilities"
});
PrivateDependencyModuleNames.AddRange(new string[] {
   "OnlineSubsystem",
   "OnlineSubsystemUtils",
   "OnlineSubsystemSteam"
});
  1. Configure Steam

In your project's Config/DefaultEngine.ini, ensure Steam subsystem entries are present:

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

Initialize SDK

Call Adjust::InitSdk(...) method once per app launch to initialize the SDK. Initialization arguments:

Arguments

  • AppToken (string, required): Your unique Adjust app token, obtainable from the Adjust dashboard.
  • Environment (string, required): Specifies the environment, e.g., Adjust::EnvironmentSandbox for testing or Adjust::EnvironmentProduction for production.

Here is an example of how to initialize the Adjust:

#include "Adjust/Adjust.h"

const FString AppToken = TEXT("YOUR_12_CHAR_TOKEN");

Adjust::InitSdk(AppToken, Adjust::EnvironmentSandbox, [](const AdjustResponseData &Response)
{
    UE_LOG(LogExample, Log, TEXT("Adjust init response: code=%lld error=%s json=%s"),
        Response.ResponseCode, *Response.Error, *Response.JsonResponse);
});

Enable SDK Logging

SDK logging is disabled by default. To enable it, call Adjust::EnableLogging(). For example:

Adjust::EnableLogging();

Track Events

To track events, call Adjust::TrackEvent. For example:

AdjustEvent Event(TEXT("YOUR_EVENT_TOKEN"));
Event.SetRevenue(1.99, TEXT("USD"));
Event.AddCallbackParameter(TEXT("key"), TEXT("value"));
Event.AddPartnerParameter(TEXT("key"), TEXT("value"));

Adjust::TrackEvent(Event, [](const AdjustResponseData& Response)
{
    UE_LOG(LogExample, Log, TEXT("Adjust event response: code=%lld error=%s json=%s"),
        Response.ResponseCode, *Response.Error, *Response.JsonResponse);
});

Request Attribution

To retrieve attribution data, call Adjust::GetAttribution method. For example:

Adjust::GetAttribution([](const AdjustResponseData& Response)
{
   UE_LOG(LogExample, Log, TEXT("Attribution code=%d message=%s tracker_token=%s tracker_name=%s network=%s campaign=%s adgroup=%s creative=%s click_label=%s"),
       Response.ResponseCode,
       *Response.Message,
       *Response.AttributionData.TrackerToken,
       *Response.AttributionData.TrackerName,
       *Response.AttributionData.Network,
       *Response.AttributionData.Campaign,
       *Response.AttributionData.Adgroup,
       *Response.AttributionData.Creative,
       *Response.AttributionData.ClickLabel);
});

License

Distributed under the MIT license.

About

This is the Steamworks Unreal SDK of

Resources

License

Stars

Watchers

Forks

Contributors