googleAnalytics.init()

Type Function
Return value none
Revision Release 2024.3703
Keywords analytics, Google Analytics, googleAnalytics, init
See also googleAnalytics.logEvent()
googleAnalytics.logScreenName()
googleAnalytics.*

Overview

Initalizes the Google Analytics plugin. This step is mandatory before any other features or methods can be used.

Syntax

googleAnalytics.init( appName, trackingID [, anonymizeIp] )
appName (required)

String. The app name specified in the Google Analytics dashboard, ensuring that data sent from the app is categorized properly.

trackingID (required)

String. The tracking ID for your account, obtained from the Google Analytics dashboard.

anonymizeIp (optional)

Boolean. Enabling anonymize IP functionality tells Google Analytics to anonymize the IP information sent by the SDK by removing the last octet of the IP address prior to its storage.

Example

local googleAnalytics = require( "plugin.googleAnalytics" )

-- Initialize Google Analytics
googleAnalytics.init( "CoronaApp1", "UA-12345678-90", true )