Revenue
With the justtrack SDK, you can track advertisement and in-app purchase revenue. Advertising revenue can be tracked automatically from the IronSource SDK right now (see Enable real-time revenue data with ironSource). If you are using another SDK to deliver ads for your users, you can track the impressions manually.
Forwarding in-app purchases
If the user performs an in-app product or subscription purchase, you can forward the purchase via the justtrack SDK to our backend. How you do this depends on the StoreKit version you're using:
- StoreKit 1
- StoreKit 2
For iOS using StoreKit 1, in-app purchases are tracked automatically, by default. However, you can use one of the following methods to change this behavior:
set(automaticInAppPurchaseTracking: Bool) -> Self
set(automaticInAppPurchaseTracking: Bool)
For example, you can use it when you build the SDK instance:
let builder = JustTrackSdkBuilder(apiToken: "prod-...") /* create the builder */
let sdk = builder
// configure the SDK when creating an instance:
.set(automaticInAppPurchaseTracking: forwardPurchasesAutomatically)
.build()
Alternatively, you can use it to configure an existing SDK instance:
sdk.set(automaticInAppPurchaseTracking: forwardPurchasesAutomatically)
When enabled, all purchases will be reported automatically to the justtrack backend and, if you have correctly configured purchase validation, show up as revenue for your app.
With StoreKit 2, you can use one of the following methods to manually forward in-app purchases to the justtrack dashboard:
forward(transaction: Transaction)
forward(transactionId: String, productId: String, quantity: Int)
Read more about transactions in Apple's documentation.
You need to call this method everywhere you handle a purchase in your code:
sdk.forward(transaction: transaction)
Forwarding in-app purchases from the SDK is only the first step toward seeing the data in justtrack. You also must set up a shared secret and server notifications. Read our documentation to learn how.
Forwarding ad impressions
Our SDK can forward ad impression data to the justtrack platform so you can track your app's ad revenue.
Automatic impression forwarding
We can automatically forward ad impressions for several partners. Use these methods to integrate the partner SDK:
AdColony
integrateWithAdColony()
AppLovin
integrateWithAppLovin(userIdSource: UserIdSource, listenFor: AppLovinAdEvent)
Chartboost
integrateWithChartboost()
adjoe WAVE
adjoe WAVE is integrated automatically if you use their SDK.
ironSource
Refer to our ironSource integration guide.
Unity
integrateWithUnityAds()
Manual impression forwarding
If your ad network isn't available for automatic ad impression forwarding, you can manually forward impression data using .forward()
:
sdk.forward(adImpression: AdImpression(format: "format", sdkName: "sdk_name")
.set(network: "network")
.set(placement: "placement")
.set(testGroup: "test_group")
.set(segmentName: "segment_name")
.set(instanceName: "instance_name")
.set(bundleId: "bundle_id")
.set(revenue: Money(value: 10.0, currency: "USD"))
)
This method accepts an AdImpression
whose parameters are:
format
: The format of the ad.sdkName
: The name of the SDK you used to fill the ad space, for exampleironsource
oradmob
. When using ad mediation, this is the name of the mediation platform.
The SDK name must be lowercase. So, for example, you would use ironsource
, not IronSource
.
Additionally, you can use .set()
with the following parameters to set more dimensions:
Method | Argument | Acceptable values |
---|---|---|
network | The name of the ad network that provided the ad. When using ad mediation, this is the ad network that won the bid for the ad space. | String value or null. |
placement | The placement of the ad. | String value or null. |
testGroup | The test group of the user, if you are A/B testing. | String value or null. |
segmentName | The name of the segment of the ad. | String value or null. |
instanceName | The name of the instance of the ad. | String value or null. |
bundleId | The bundle ID for the app being advertised. | String value or null. |
revenue | The amount of revenue this ad generated. | Money object with a non-negative amount. The currency must be a three-letter uppercase ISO 4217 string. |
Upon success .forward()
returns true. If a parameter is invalid, false is returned.