Android Analytics
Adjust tracking is configured automatically via the Alogame backend. No local setup required in the SDK.
Event names, their Adjust tokens, and the Adjust app token are managed by your game operator on the backend — you do not configure them in the app. As a developer you only call the logging APIs below with the event name agreed with your operator.
Auto-Tracked Events
The SDK automatically tracks the following lifecycle events when configured in the backend:
| Event Name | Description | Trigger |
|---|---|---|
sdk_show_login | Login screen displayed | User opens login UI |
sdk_register_success | Registration completed | User successfully registers |
sdk_login_success | Login completed | User successfully logs in (manual login only) |
sdk_logout | User logged out | User logs out or session expires |
sdk_recharge | In-app purchase completed | IAP verification succeeds |
These events are tracked automatically once your operator has set them up on the backend. No game code required.
Set Game Role
To enable role-specific tracking data (used in sdk_recharge and other events), call setGameRole() after the player enters the game:
import vn.oeg.sdk.v2.core.auth.OEGAuthCore
OEGAuthCore.setGameRole(
serverId = "server_01",
serverName = "Server 1", // optional
roleId = "character_123",
roleName = "DragonSlayer", // optional
level = 50 // optional
)
import vn.oeg.sdk.v2.core.auth.OEGAuthCore;
// serverId, serverName (null = omit), roleId, roleName (null = omit), level (0 = default)
OEGAuthCore.INSTANCE.setGameRole("server_01", "Server 1", "character_123", "DragonSlayer", 50);
This information is used to enrich tracking events with player context. The SDK automatically clears this data on logout.
See also: Game Role API for detailed documentation and usage examples.
Log an event
The SDK can log any event — there is no fixed list. An event is just a name plus optional string parameters. Which events exist, and how each name maps to an Adjust event token, is defined by your game operator (in Adjust + the Alogame backend); the SDK resolves the name to a token at runtime. You only need the event name agreed with your operator.
An event whose name has no token configured is silently skipped (no tracking, no error).
import vn.oeg.sdk.v2.core.analytics.OEGAnalytics
OEGAnalytics.logEvent("tutorial_complete")
OEGAnalytics.logEvent("level_up", mapOf(
"level" to "10",
"score" to "15000"
))
import vn.oeg.sdk.v2.core.analytics.OEGAnalytics;
import java.util.HashMap;
import java.util.Map;
OEGAnalytics.INSTANCE.logEvent("tutorial_complete");
Map<String, String> params = new HashMap<>();
params.put("level", "10");
params.put("score", "15000");
OEGAnalytics.INSTANCE.logEvent("level_up", params);
Log a revenue event
Events that carry money — Recharge (web_store / WebPay top-ups), first_recharge, or any custom revenue event — must set the real Adjust revenue with logRevenue. Sending the amount only as a plain parameter (e.g. charged_value) is not counted by Adjust — the dashboard would show 0.
The native Google Play IAP flow fires sdk_recharge with revenue already set — no game code needed. Use logRevenue only for events the game pushes itself (web_store / WebPay recharges and custom revenue events).
The revenue is attached to the event's own token, so that event must be set up as a revenue event by your game operator. orderId deduplicates against double-counting.
import vn.oeg.sdk.v2.core.analytics.OEGAnalytics
OEGAnalytics.logRevenue(
"Recharge", // event name set up as a revenue event by your operator
revenue = 99000.0, // real amount paid (must be > 0)
currency = "VND", // ISO 4217
orderId = "order_12345", // dedup id
parameters = mapOf("payment_channel" to "web_store", "product_id" to "vip_pack_1")
)
import vn.oeg.sdk.v2.core.analytics.OEGAnalytics;
import java.util.HashMap;
import java.util.Map;
Map<String, String> params = new HashMap<>();
params.put("payment_channel", "web_store");
params.put("product_id", "vip_pack_1");
// logRevenue(eventNameOrToken, revenue, currency, orderId, parameters)
OEGAnalytics.INSTANCE.logRevenue("Recharge", 99000.0, "VND", "order_12345", params);
A recharge is a revenue event — always send it via
logRevenue, not the plainlogEvent, otherwise Adjust records no revenue.
Enable / disable tracking
OEGAnalytics.setTrackingEnabled(false)
OEGAnalytics.setTrackingEnabled(true)
OEGAnalytics.INSTANCE.setTrackingEnabled(false);
OEGAnalytics.INSTANCE.setTrackingEnabled(true);
Uninstall Tracking
Uninstall tracking is automatic — no game code required. When the FCM token is obtained or rotated, the SDK forwards it to Adjust. Adjust then periodically sends a silent push to each device; if delivery fails, the device is counted as an uninstall.
Requirements:
- FCM must be configured (see Push Notifications)
OEGNotificationServicedeclared inAndroidManifest.xml- Adjust app token configured by your operator
Deep Link Reattribution
To attribute re-engagement campaigns (user taps an Adjust link while the app is already installed), call OEGAnalytics.processDeeplink() from your main Activity. Install attribution works regardless — this is only needed to credit campaigns that bring back existing users.
import android.content.Intent
import vn.oeg.sdk.v2.core.analytics.OEGAnalytics
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
intent?.data?.let { OEGAnalytics.processDeeplink(it, this) }
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
intent.data?.let { OEGAnalytics.processDeeplink(it, this) }
}
}
import android.content.Intent;
import vn.oeg.sdk.v2.core.analytics.OEGAnalytics;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent() != null && getIntent().getData() != null) {
OEGAnalytics.INSTANCE.processDeeplink(getIntent().getData(), this);
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent != null && intent.getData() != null) {
OEGAnalytics.INSTANCE.processDeeplink(intent.getData(), this);
}
}
Lifecycle
Call in your main game Activity:
override fun onResume() {
super.onResume()
OEGAnalytics.onResume()
}
override fun onPause() {
super.onPause()
OEGAnalytics.onPause()
}
@Override
public void onResume() {
super.onResume();
OEGAnalytics.INSTANCE.onResume();
}
@Override
public void onPause() {
super.onPause();
OEGAnalytics.INSTANCE.onPause();
}