googleAnalytics.* — Google Analytics

Type Library
Revision Release 2021.3646
Keywords analytics, Google Analytics, Google Analytics v2, googleAnalytics, googleAnalytics v2
Platforms Android, iOS
Sample https://github.com/coronalabs/plugins-sample-googleAnalytics

Overview

The Google Analytics plugin lets you measure the value of your app across all stages, discover what keeps users engaged, and learn how to make your app more successful.

Important
  • Google Analytics v2 requires setting up a Firebase account. See legacy plugin for non-Firebase Google Analytics

Registration

Before implementing the Google Analytics plugin, you must setup a Firebase Project and add google-services.json for Android and/or add GoogleService-Info.plist for iOS, provided in the Firebase console, to project settings to your Solar2D project's root directory alongside main.lua.

Syntax

local googleAnalytics = require( "plugin.googleAnalytics.v2" )

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    android =
    {
                useGoogleServicesJson = true, -- Needed for Android
    },
    plugins =
    {
        ["plugin.googleAnalytics.v2"] =
        {
            publisherId = "com.solar2d"
        },
    },      
}
Note

For Android, the following permissions/features are automatically added when using this plugin:

  • "android.permission.INTERNET"
  • "android.permission.ACCESS_NETWORK_STATE"
  • "android.permission.WAKE_LOCK"

Support