Note that analytics integrations are only available on enterprise accounts.  Please contact [email protected] if you want to use these features and currently do not have access.


A few simple steps will get you up and running with Nami and your analytics service.

  1. Register an analytics handler.
  2. Add analytics calls for each type of Nami action you wish to track.
  3. Append any Nami provided metadata to each of your analytics calls.

The Nami SDK provides a simple function to register an analytics service.  Simply add this call in your AppDelegate where you handle the setup of the Nami SDK. 

NamiAnalyticsSupport.registerAnalyticsHandler { (actionType : NamiAnalyticsActionType, analyticsItems : [String:Any]) in
    switch actionType {
        case .paywallRaise:
        case .paywallClosed:
        case .paywallRaiseBlocked:
        case .purchaseActivity:
        @unknown default:

Note that the Nami SDK will send you two objects for use in analytics: actionType  and analyticsItems .  We'll dig into each one below.

Action Types

The Analytics Handler supports the following action types

  • paywallRaise  This event will be fired when the Nami SDK displays a paywall to your user
  • paywallClosed  occurs when the user clicks the close button to dismiss the paywall
  • paywallRaiseBlocked  can occur in one of 2 ways:
    1.  The campaign rules would have raised the paywall but the frequency capping that limits how frequently you wish to display your paywall prevented it from showing
    2.  The campaign rules tried to raise a paywall, but you used a Paywall Gate to prevent the SDK from raising the paywall in a certain section of your app.  
  • purchaseActivity  is fired when a user makes a purchase from a paywall raised by the Nami SDK

Metadata in analyticsItems

When any of the four above action types occur, the Nami SDK is able to provide any of the following metadata elements that you may attach to an analytics event.  Different metadata is available for different Action Types.

For all Action Types

  • campaignID  unique ID for the campaign
  • campaignName the name of the campaign in the Control Center
  • campaignType  the type of the Nami campaign that resulted in this paywall being displayed
  • namiTriggered  true  or false  based on whether your campaign rules triggered the display of the paywall or the user invoked the paywall
  • paywallID  unique id for the paywall
  • paywallName the name of the paywall in the Control Center
  • paywallType  the type of the paywall 
  • paywallProducts   a list of all products included on the paywall as NamiMetaProduct objects

We recommend converting paywallProducts  into a list of product identifiers with some suitable separator before sending it to your analytics.  A code snippet that generates a comma separated string of all products is below.

if let products = analyticsItems["paywallProducts"] as? [NamiMetaProduct] {
    let productList : String = products.reduce("", { (result, product) -> String in
        if result.isEmpty {    
            return product.productIdentifier
        } else {
            return result + "," + product.productIdentifier

Specific to purchaseActivity

  • purchaseActivityType  one of newPurchase, cancelled, resubscribe, or restored
  • purchaseTimestamp  Swift Date object with the time of purchase
  • purchasedProduct  a NamiMetaProduct object with metadata about the product the user purchased 

Example Apps

We have provided a few example apps that show how to set up this integration for common analytics providers.

Did this answer your question?