kochavaFAA.logEvent()

Type Function
Return value none
Revision Release 2022.3683
Keywords analytics, attribution, Kochava Free App Analytics, logEvent
See also kochavaFAA.logDeeplinkEvent()
kochavaFAA.*

Overview

Sends an event with pre-defined types and parameters to Kochava.

Syntax

kochavaFAA.logEvent( eventType, params )
eventType (required)

String. The type of the event. This can be one of the following strings:

  • "achievement"
  • "adView"
  • "addToCart"
  • "addToWishList"
  • "checkoutStart"
  • "levelComplete"
  • "purchase"
  • "rating"
  • "registrationComplete"
  • "search"
  • "tutorialComplete"
  • "view"
params (required)

Table. Table containing key-value parameters. Valid keys and associated data types are listed below. You may use these keys and parameters in any combination you see fit.

Note

Kochava supports the logging and verification of app store receipts, but only when eventType is "purchase". In this case, the following parameters can be added to the params table for this purpose:

  • "receiptData" (string) — This parameter expects the data from event.transaction.receipt found in the in-app purchase transaction callback. Supported markets include Apple IAP and Google IAP.

  • "receiptDataSignature" (string) — This parameter is mandatory when logging a Google IAP receipt. It expects the data from event.transaction.signature found in the in-app purchase transaction callback.

Examples

In-App Purchase
local kochavaFAA = require( "plugin.kochava.faa" )

local function kochavaListener( event )
    -- Handle events here
end

-- Initialize plugin
kochavaFAA.init( kochavaListener,
    {
        appGUID = "YOUR_APP_GUID"
    }
)
kochavaFAA.logEvent( "purchase",
    {
        userId = "USER_ID",
        name = "ITEM_NAME",
        currency = "usd",
        quantity = 2,
        price = 2.50,
        date = "2016-12-30"
    }
)
Game Level Completed
local kochavaFAA = require( "plugin.kochava.faa" )

local function kochavaListener( event )
    -- Handle events here
end

-- Initialize plugin
kochavaFAA.init( kochavaListener,
    {
        appGUID = "YOUR_APP_GUID"
    }
)

kochavaFAA.logEvent( "levelComplete",
    {
        userId = "USER_ID",
        level = "2",
        score = "22000"
    }
)