Type Function Return value none Revision Release 2024.3703 Keywords analytics, attribution, Kochava, logEvent See also kochava.logDeeplinkEvent() kochava.*
Sends a custom event or an event with pre-defined types and parameters to Kochava.
kochava.logEvent( eventType, params )
String. The type of the event. For Standard Events this can be one of the following strings:
"achievement"
"adView"
"addToCart"
"addToWishList"
"checkoutStart"
"levelComplete"
"purchase"
"rating"
"registrationComplete"
"search"
"tutorialComplete"
"view"
For custom events you can specify any valid string that does not begin with an underscore.
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.
adCampaignId
(string)adCampaignName
(string)adDeviceType
(string)adGroupId
(string)adGroupName
(string)adMediationName
(string)adNetworkName
(string)adPlacement
(string)adSize
(string)adType
(string)checkoutAsGuest
(boolean)contentId
(string)contentType
(string)currency
(string)date
(string formatted as "yyyy-mm-dd"
)description
(string)destination
(string)durationTimeInterval
(number)endDate
(string formatted as "yyyy-mm-dd"
)itemAddedFrom
(string)level
(string)maxRating
(number)name
(string)orderId
(string)origin
(string)price
(number)quantity
(number)ratingValue
(number)receiptId
(string)referralFrom
(string)registrationMethod
(string)results
(string)score
(string)searchTerm
(string)spatialX
(number)spatialY
(number)spatialZ
(number)startDate
(string formatted as "yyyy-mm-dd"
)success
(string)userId
(string)userName
(string)validated
(string)You may also specify your own custom key-value parameters. Values may be of type String, Number or Boolean.
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
"receiptDataSignature"
(string) — This parameter is mandatory when logging a Google IAP receipt. It expects the data from event.transaction.signature
found in the
local kochava = require( "plugin.kochava" ) local function kochavaListener( event ) -- Handle events here end -- Initialize plugin kochava.init( kochavaListener, { appGUID = "YOUR_APP_GUID" } ) kochava.logEvent( "purchase", { userId = "USER_ID", name = "ITEM_NAME", currency = "usd", quantity = 2, price = 2.50, date = "2016-12-30" } )
local kochava = require( "plugin.kochava" ) local function kochavaListener( event ) -- Handle events here end -- Initialize plugin kochava.init( kochavaListener, { appGUID = "YOUR_APP_GUID" } ) kochava.logEvent( "levelComplete", { userId = "USER_ID", level = "2", score = "22000" } )