Unity SDK Analytics
Preparation
Remember, you need to configure and initialize the Magify Service to collect analytics.
You may also want to pass some configuration parameters to better collect analytics:
- Set iOS ATT status on initialization or later in runtime;
- Set GDPR agreement status on initialization;
- Set media source in runtime.
What analytics does the SDK collect?
There are several analytical models built into the SDK that are built automatically. You will not interact with them directly, but some SDK settings may affect the content of the collected data.
Start of sessions
This kind of analytics is collected every time a new session starts. This also collects information about the InApp status and Subscription status of the user.
Going to the background
Events are collected to understand when the user minimized the application or closed it.
Applovin Max/LevelPlay ads impressions
When a banner/interstitial/reward ad is shown, we collect analytics. For correct operation you need to select and install the mediator you will use and link it with Magify SDK.
- To implement it see MagifyService.SetAdsMediator and IMinimalAdsMediator;
- Also should check default implementations of this mediators: for Applovin Max and for LevelPlay.
Your own ads impressions
When you use an ad mediation service other than Applovin or IronSource and want to track ads impressions:
- Use MagifyManager.TrackCustomAdsImpression method to track ads impressions.
- Only for advanced version SDK: Implement ICampaignHandler for each campaign type you use (interstitial, reward ad) to link impressions to your campaigns. Without it, impressions are still tracked, but interstitial and rewarded ad impressions are not linked to a campaign.
Ad revenue totals
Every ads impression the SDK tracks — through the Applovin Max or LevelPlay mediator, MagifyManager.TrackAdsImpression or MagifyManager.TrackCustomAdsImpression — adds its revenue to lifetime ad revenue totals, grouped by revenue precision and currency. The totals are stored on the device and sent with every context request; Magify uses them for segmentation by eCPM. No extra call is needed.
- Revenue of Applovin Max and LevelPlay impressions is counted in USD.
- A custom impression is added to the totals only with a supported
publisherCurrency(an ISO 4217 code such asUSDorEUR,USDwhen empty) and a revenue of zero or more. In both cases it is still tracked as an impression.
InApp / Subscription
These types of analytics are collected when InApp products are purchased or Subscription purchase are made. For correct operation you need to select and install the purchasing provider you will use and link it with Magify SDK.
- To implement it see MagifyService.SetPurchasingProvider and IMinimalInAppStore.
Your custom events
Send your own analytics events with the TrackEvent method. Each event has a name and parameters. The name must follow the naming rules.
Game state
If your game has game modes or levels, call SetGameMode, SetGameLevel and SetGameMaxLevel each time these values change. The SDK adds the current values to Applovin Max and LevelPlay ads impressions, in-app purchases, new subscriptions (trial and paid) and custom events.
- The SDK does not save these values. Set them again after each SDK initialization and after MagifyService.Reset or MagifyManager.Reset.
- MagifyManager.TrackCustomAdsImpression does not use these values: it takes
level,maxLevelandmodefrom its own parameters.
Paying state notes
You can read about paying statuses here.