Google Analytics Documentation.

Importing SDKBOX GoogleAnalytics

First import the sdkbox_googleanalytics unity package into your project. This will create a directory SDKBOX under Assets. If you have other SDKBOX plugins installed, they will appear here too. A plugins directory may also be present if you have other SDKBOX plugins. This directory contains files for iOS and Android.

Using the GoogleAnalytics Plugin

To begin using GoogleAnalytics plugin, find the GoogleAnalytics prefab in the Assets/SDKBOX/googleanalytics directory.

Drag an instance of this prefab into the scene where you want to start using analytics. You should only have a single instance of this prefab at any time.

Select the GoogleAnalytics game object in the hierarchy and in your inspector pane you can configure the object to complete the setup.

Configuring the GoogleAnalytics Plugin

Description of Fields

iOS Tracking Code

This is the tracking code from your Google Analytics account. You can use the same code for both platforms if you like, or you can have different codes for each. It's up to you.

Android Tracking Code

This is the tracking code from your Google Analytics account. You can use the same code for both platforms if you like, or you can have different codes for each. It's up to you.

Manual Setup

IOS Platform

if you compile iOS project fail, maybe need add follow framework:

libsqlite3.tbd

libz.tbd

CoreData.framework

GoogleAnalytics API

The analytics session is being explicitly started at plugin initialization time.

public static void startSession();

You normally will never stop a session manually. But if you need to, you can call this manually.

static void stopSession();

Manually request dispatch of hits. By default, data is dispatched from the Google Analytics SDK for Android every 5 minutes.

static void dispatchHits();

Change the dispatch info time period to the desired amount of seconds.

static void dispatchPeriodically(int seconds);

Stop periodically sending info. Then manually the dispatchPeridically
or dispatchHits should be called.

static void stopPeriodicalDispatch();

Set user ID for this tracking session.

static void setUser(string userID);

Set value for custom dimension.

static void setDimension(int index, string value);

Set value for custom metric.

static void setMetric(int index, string value);

Log screen info. title is the title of a screen. Screens are logical units
inside your app you'd like to identify at analytics panel.

Log a social event.

While running on dry run, the tracked events won't be sent to the actual
analytics account.

static void setDryRun(bool enable);

Enable advertising tracking when in google's ad vendors.

static void enableAdvertisingTracking(bool enable);

Create a tracker identified by the google analytics tracker id XX-YYYYYYYY-Z.
If the tracker already existed, no new tracker will be created. In any case, the tracker associated with tracker id will be set as default tracker for analytics operations.

static void createTracker(string trackerId);

* Enable a tracker identified by a trackerId. If the tracker does not exist,
* nothing will happen.