Nami ML

Nami ML Documentation

Welcome to the Nami ML documentation hub. You'll find comprehensive guides and documentation to help you start working with Nami ML as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Analytics Integration Guide

Step-by-step instructions to get up and running with any 3rd party analytics service.

📘

Custom Billing Plan Feature

Third-party analytics integrations require a subscription to one of our Custom billing plans. Please contact us at [email protected] if you'd like to add this functionality to your account.

Overview

The Nami SDK offers support for custom 3rd-party analytics integrations that will work with all your favorite analytics providers including:

  • Adobe Analytics
  • Amplitude
  • Ensighten Pulse
  • Google Analytics / Firebase
  • Heap
  • KISSmetrics
  • Mixpanel
  • mParticle
  • and any others!

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

  1. Register an analytics handler. Add the code below to your AppDelegate in the function where you handle the setup of the Nami SDK for iOS. In React Native, add the javascript code in the first screen that displays when your app loads.
NamiAnalyticsSupport.registerAnalyticsHandler { (actionType : NamiAnalyticsActionType, analyticsItems : [String:Any]) in
    switch actionType {
        case .paywallRaise:
            break;
        case .paywallClosed:
            break;
        case .paywallRaiseBlocked:
            break;
        case .purchaseActivity:
            break;
        @unknown default:
            break;
    }
}
const { NamiAnalyticsEmitter } = NativeModules;
const analyticsEmitter = new NativeEventEmitter(NamiAnalyticsEmitter);

useEffect(() => {
  analyticsEmitter.addListener('NamiAnalyticsSent', onNamiAnalyticsReceived);
}, []);
  
const onNamiAnalyticsReceived = (event) => {
  const { analyticsItems, actionType } = event;

  switch (actionType) {
    case 'paywall_raise':
      break;
    case 'paywall_closed':
      break;
    case 'paywall_raise_blocked':
      break;
    case 'purchase_activity':
      break;
    default:
      break;
  }
}
  1. Add analytics calls for each type of Nami action you wish to track.
  2. Append any Nami provided metadata to each of your analytics calls.

Note that the Nami SDK will send you two objects that you can use to pass data to your analytics provider: actionType and analyticsItems. We provide more detail on each of these below.

Action Types

The analytics handler you set up in the previous section 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 a paywall.
  • paywallRaiseBlocked can occur in one of 2 ways
    • The campaign rules would have raised a paywall, but the frequency capping that limits how frequently a user is shown a paywall prevented it from displaying.
    • The campaign rules tried to raise a paywall, but you have specifically blocked a paywall from being displayed 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 Available

When any of the four action types in the previous section occur, the Nami SDK provides several items of metadata that you may attach to the event. Some action types have different metadata available.

For all action types

  • campaignID unique ID for the campaign
  • campaignName the name of the campaign in the Control CenterControl Center - The Nami Control Center is our web platform that allows you to control the Nami experience in your app from the cloud.
  • 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 CenterControl Center - The Nami Control Center is our web platform that allows you to control the Nami experience in your app from the cloud.
  • paywallType the type of the paywall
  • paywallProducts a list of all products included on the paywall as Product SKU objects

👍

Nami Best Practice

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
        }
})
if (analyticsItems.paywallProducts && analyticsItems.paywallProducts.length) {
  let products = analyticsItems.paywallProducts.map((product, index) => {
    return product.productIdentifier
  }).join(",")
}

Specific to purchaseActivity

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

Updated about 12 hours ago



Analytics Integration Guide


Step-by-step instructions to get up and running with any 3rd party analytics service.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.