I am pleased to announce my first Unity3D plugin is now available for download. EZ Analytics for Android offers Unity3D developers a native solution for Google Analytics with as little as two lines of code.
When importing, if /Assets/Plugins/Android/ApplicationManifest.xml already exists, do not import from EZ Analytics as it will override the existing version. Instead, add the following three lines to your manifest if they don’t already exist:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This plugin relies on Android native resources so the Google Play Services library must be added to your Android plugins folder. This can typically be found here:
$ANDROID_HOME/extras/google/google_play_services/libproject/google-play-services_lib
In a script on one of your GameObjects
, add the following line to the Start() method replacing the tracking code with your own:
EZAGoogleManager.init("UA-XXXX-XX");
After, you can use any of the following methods in your project:
public static void init(string propertyId);
public static void sendView(string screenName);
public static void sendEvent(string screenName, string eventCategory, string eventAction);
public static void sendSocial(string screenName, string socialNetwork, string socialAction, string socialTarget);
public static void sendItemData(string transactionId, string productName, string productSku, string productCategory, double price, long quantity);
public static void sendException(string screenName, string description, bool isFatal);
https://bitbucket.org/nraboy/ez-analytics/issues