Skip to content

Logging Events

LogEvent

Call LogEvent with an instance of any class decorated with [TactileAnalytics.EventAttribute]:

var analytics = playOpsSDK.Analytics();
analytics.LogEvent(new LevelCompleteEvent("level_01_easy"));

LogEvent accepts any object — the SDK reflects on it at flush time to extract property values. The event class must be decorated with the correct attributes for the schema to be valid. See Defining Custom Events.

LogPurchase

Log an in-app purchase transaction. The receipt is sent to the server for validation:

using TactileModules.Analytics;
var product = new Product(
id: "com.mygame.coins_500",
title: "500 Coins",
price: 499, // price in cents
localCurrencyCode: "USD",
localPrice: 4.99
);
var transaction = new Transaction(
purchaseSessionId: sessionId,
product: product,
transactionId: transactionId,
transactionReceipt: receiptString,
orderId: orderId,
transactionSignature: signature,
transactionTimestamp: DateTime.UtcNow,
purchaseProvider: "apple" // or "google"
);
analytics.LogPurchase(transaction);

Purchase validation happens server-side against the Apple or Google receipt APIs. The result is attributed back to the player’s session in the dashboard.

Subscribing to logged events

Use the EventLogged event if you need to observe outgoing analytics events — useful for debugging or forwarding to a secondary analytics provider:

analytics.EventLogged += (evt) =>
{
Debug.Log($"[Analytics] {evt.Name}");
};