Tracking Events (Non Revenue)
Singular can collect data about in-app events to help analyze the performance of your campaigns and measure KPIs. For example, your organization may want to collect data about user logins, registrations, tutorial completions, or leveling up in a gaming app.
Singular supports a variety of standard events. These commonly used events are often supported by ad networks for reporting and optimization. Another advantage is that when you use standard event names, Singular recognizes them automatically and adds them to the Events list without you having to define them manually. We recommend using standard events whenever possible.
The list of events sent to Singular (with the accompanying attributes) should be compiled by the UA/marketing/business team based on your organization's marketing KPIs. The business team can follow the guide at How to Track In-App Events: Guide For Singular Attribution Customers.
With each event you track, you can pass various attributes. See the recommended standard attributes per event.
In your code, send events to Singular using the event or eventWithArgs methods.
Note: For standard events, use the event's Flutter name as it appears in the Flutter SDK List of Standard Events and Attributes, e.g., sngLogin.
For custom events, events that your organization wants to measure that do not match any of Singular's standard events, use any custom name (maximum of 32 characters). We recommend using names in English for compatibility with any ad network partners that may receive the event from Singular for optimization purposes.
Example:
Singular.event(Events.sngLogin);
Singular.eventWithArgs(eventName, {attributeName:attributeValue});
Map<String, Object> map = HashMap<String, Object>();
map ['name'] = 'John Doe';
map ['age'] = 30;
map ['isStudent'] = false;
Singular.eventWithArgs('event_Name', map);
Tracking Revenue
Sending IAP Events
To let Singular track how much revenue your app is making, send IAP events to Singular. By sending the IAP event you also allow Singular to check the event verification data and make sure it's not fraudulent.
See the following example.
Note: This code snippet requires the Flutter IAP package at https://pub.dev/packages/in_app_purchase.
import 'package:singular_flutter_sdk/singular_iap.dart';
import 'dart:io' show Platform;
// Parse the revenue amount and currency first
double revenue = double.tryParse(product.rawPrice.toStringAsFixed(2)) ?? 0.0;
String? currencyCode = product.currencyCode;
// Only process if both revenue is greater than 0 and currencyCode exists
if (revenue > 0 && currencyCode != null && currencyCode.isNotEmpty) {
if (Platform.isIOS) {
singularPurchase = new SingularIOSIAP(
revenue,
currencyCode,
purchase.productID,
purchase.purchaseID,
purchase.verificationData.serverVerificationData
);
}
else if (Platform.isAndroid) {
singularPurchase = new SingularAndroidIAP(
revenue,
currencyCode,
purchase.verificationData.serverVerificationData,
purchase.verificationData.localVerificationData
);
}
Singular.inAppPurchase(eventName, singularPurchase);
}
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR".
Alternative Method: Sending Custom Revenue Events
Singular also offers the option of reporting revenue by just sending a custom revenue event with a name and a revenue amount. Note that this method does not share the purchase receipt with Singular and therefore, does not allow Singular to verify that it's a legitimate event.
For example:
Singular.customRevenue("MyCustomRevenue", "USD", 5.50);
Map<String, Object> map = HashMap<String, Object>();
map ['name'] = 'John Doe';
map ['age'] = 30;
map ['isStudent'] =false;
Singular.customRevenueWithAttributes('MyCustomRevenue','USD', 20, map);
Note: Pass currency as a three-letter ISO 4217 currency code, e.g., "USD," "EUR", "INR".
Hybrid Event Tracking (Advanced)
Singular recommends sending all events and revenue through the Singular SDK integrated into your app. However, Singular can collect events and revenue from other sources.
Any event NOT sent from the Singular SDK must comply with Singular's Server-to-Server Event documentation requirements and provide the matching device identifier to correctly attribute an event.
Important:
Discrepancies will occur if device identifiers used on Server-to-Server event requests do not have a matching device identifier in Singular. Be aware of the following possibilities:
- If an event request is received "before" the Singular SDK has recorded the device identifier, from an App Session, then the event request will be considered the "first session" for the unknown device, and Singular will attribute the device as an organic attribution.
- If the Singular SDK did record a device identifier, but the Singular SDK identifier differs from the device identifier specified in the Server-to-Server Event request then the event will be attributed incorrectly.
Hybrid Event Tracking Guides
Singular can collect data about revenue from your Server to help analyze the performance and ROI of your campaigns.
Requirements:
- From an in-app Registration or Login Event, capture and pass the device identifiers and store this data with the User ID on your server. Because device identifiers may change for a user, be sure to update the identifiers when a user generates an app session. This guarantees the server-side event will be attributed to the correct device.
- Server-side events are platform specific and should only be sent with the device identifier matching the device platform (e.g., IDFA or IDFV for iOS devices).
- You can use the Singular Internal BI postback mechanism to push an event in real time to your internal endpoint so that you can update the data set on the server side. See the Internal BI Postback FAQ.
- Review the "Tracking Revenue" section in the Server-to-Server Integration guide for details.
Follow the links below for details on how to enable these partners.