Type Function
Return value none
Revision Release 2024.3703
Keywords analytics, attribution, Tenjin, init
See also tenjin.*


tenjin.init() initializes the Tenjin SDK.

Once initialized, you can call any of the other Tenjin API functions such as tenjin.logEvent().


tenjin.init( listener, params )
listener (required)

Listener. Listener that will receive analyticsRequest events.

params (required)

Table. Table containing Tenjin initialization values — see the next section for details.

Parameter Reference

The params table includes parameters for the Tenjin initialization.

apiKey (required)

String. Your Tenjin API Key, gathered from the Tenjin system.

hasUserConsent (optional)

Boolean. If set to false, Tenjin will enable GDPR data collection restrictions, set to true for opposite. Default is false.

registerAppForAdNetworkAttribution (optional)

Boolean. If set to true, Tenjin SDK registerAppForAdNetworkAttribution will be called.


local tenjin = require( "plugin.tenjin" )

local function tenjinListener( event )
    -- Handle events here

-- Initialize plugin
tenjin.init( tenjinListener, { apiKey="YOUR_API_KEY" } )