├── .gitignore ├── GoogleAnalyticsV3_bitcode.unitypackage ├── GoogleAnalyticsV4_bitcode.unitypackage ├── GoogleAnalyticsV4_nobitcode.unitypackage ├── LICENSE ├── README.md ├── googleanalyticsv3.unitypackage ├── iOS Extras └── PostprocessBuildPlayer_GA └── source ├── Editor └── PostprocessBuildPlayer ├── GoogleAnalytics ├── Editor.meta └── Editor │ └── GoogleAnalyticsDependencies.xml ├── PlayServicesResolver ├── Editor.meta └── Editor │ ├── Google.IOSResolver_v1.2.56.0.dll │ ├── Google.JarResolver_v1.2.56.0.dll │ ├── Google.VersionHandler.dll │ ├── Google.VersionHandlerImpl_v1.2.56.0.dll │ └── play-services-resolver_v1.2.56.0.txt └── Plugins ├── Android ├── libGoogleAnalyticsServices.jar └── readme.txt ├── Editor ├── AdvertiserOptIn.js ├── RangedTooltipDrawer.js └── TooltipDrawer.cs ├── GoogleAnalyticsV3 ├── Attributes │ ├── RangedTooltipAttribute.cs │ └── TooltipAttribute.cs ├── Field.cs ├── Fields.cs ├── GAIHandler.cs ├── GAv3.prefab ├── GoogleAnalyticsAndroidV3.cs ├── GoogleAnalyticsMPV3.cs ├── GoogleAnalyticsV3.cs ├── GoogleAnalyticsiOSV3.cs └── HitBuilders │ ├── AppViewHitBuilder.cs │ ├── EventHitBuilder.cs │ ├── ExceptionHitBuilder.cs │ ├── HitBuilder.cs │ ├── ItemHitBuilder.cs │ ├── SocialHitBuilder.cs │ ├── TimingHitBuilder.cs │ └── TransactionHitBuilder.cs ├── GoogleAnalyticsV4 ├── Attributes │ ├── AdvertiserOptInAttribute.cs │ ├── RangedTooltipAttribute.cs │ └── TooltipAttribute.cs ├── Field.cs ├── Fields.cs ├── GAIHandler.cs ├── GAv4.prefab ├── GoogleAnalyticsAndroidV4.cs ├── GoogleAnalyticsMPV3.cs ├── GoogleAnalyticsV4.cs ├── GoogleAnalyticsiOSV3.cs ├── HitBuilders │ ├── AppViewHitBuilder.cs │ ├── EventHitBuilder.cs │ ├── ExceptionHitBuilder.cs │ ├── HitBuilder.cs │ ├── ItemHitBuilder.cs │ ├── SocialHitBuilder.cs │ ├── TimingHitBuilder.cs │ └── TransactionHitBuilder.cs ├── LICENSE └── README ├── iOS-bitcode ├── GAI.h ├── GAIDictionaryBuilder.h ├── GAIEcommerceFields.h ├── GAIEcommerceProduct.h ├── GAIEcommerceProductAction.h ├── GAIEcommercePromotion.h ├── GAIFields.h ├── GAIHandler.h ├── GAIHandler.m ├── GAILogger.h ├── GAITrackedViewController.h ├── GAITracker.h ├── VERSION_3_15 └── libGoogleAnalyticsServices.a └── iOS-nobitcode ├── GAI.h ├── GAIDictionaryBuilder.h ├── GAIEcommerceFields.h ├── GAIEcommerceProduct.h ├── GAIEcommerceProductAction.h ├── GAIEcommercePromotion.h ├── GAIFields.h ├── GAIHandler.h ├── GAIHandler.m ├── GAILogger.h ├── GAITrackedViewController.h ├── GAITracker.h ├── VERSION_3_13 └── libGoogleAnalyticsServices.a /.gitignore: -------------------------------------------------------------------------------- 1 | # OS or Editor folders 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /GoogleAnalyticsV3_bitcode.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/GoogleAnalyticsV3_bitcode.unitypackage -------------------------------------------------------------------------------- /GoogleAnalyticsV4_bitcode.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/GoogleAnalyticsV4_bitcode.unitypackage -------------------------------------------------------------------------------- /GoogleAnalyticsV4_nobitcode.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/GoogleAnalyticsV4_nobitcode.unitypackage -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This repo is no longer actively maintained 2 | 3 | # Google Analytics Plugin for Unity (beta) 4 | _Copyright (c) 2014 Google Inc. All rights reserved._ 5 | 6 | The __Google Analytics__ Plugin for Unity allows game developers to easily implement __Google Analytics__ in their Unity games on all platforms, without having to write separate implementations. Note that this is a beta and as such may contains bugs or other issues. Please report them through the Github [issue tracker](https://github.com/googleanalytics/google-analytics-plugin-for-unity/issues) or submit a pull request. The plugin comes with no guarantees. 7 | 8 | _Unity is a trademark of Unity Technologies._ This project is not in any way endorsed or supervised by Unity Technologies. 9 | 10 | _iOS is a trademark of Apple, Inc._ 11 | 12 | ## Google Analytics Plugin Documentation 13 | 14 | Visit [Google Analytics Developers](https://developers.google.com/analytics/) for the latest documentation on the [Google Analytics Plugin for Unity](https://developers.google.com/analytics/devguides/collection/unity/). 15 | 16 | 17 | ### Quick links 18 | - [Dev Guide](https://developers.google.com/analytics/devguides/collection/unity/devguide) - Learn how to setup, configure and get started with the Google Analytics Plugin for Unity. 19 | - [API Reference](https://developers.google.com/analytics/devguides/collection/unity/reference) - Describes how to send data and lists all of the methods for the Google Analytics Plugin for Unity. 20 | - [Troubleshooting](https://developers.google.com/analytics/devguides/collection/unity/troubleshoot) - Tips on debugging and troubleshooting problems with the Google Analytics Plugin for Unity. 21 | 22 | 23 | ### Related resources 24 | - [Mobile Implementation Guide](https://developers.google.com/analytics/solutions/mobile-implementation-guide) - Learn how to use Google Analytics to measure user interactions and answer questions about game usage. 25 | - [Mobile App Analytics Google Group](https://groups.google.com/forum/?fromgroups#!forum/ga-mobile-app-analytics) - Community forum where you can ask and answer questions about the plugin. 26 | 27 | 28 | ## Thanks 29 | - [Knoxx-](https://github.com/Knoxx-) for fixing a typo in the Campaign tracking permissions 30 | - [mataneine](https://github.com/mataneine) for filtering out meta files during iOS build post processing 31 | - [g8minhquan](https://github.com/g8minhquan) for identifying the sqlite3.dylib library needs to be added if using the -ObjC linker flag 32 | - [coquifrogs](https://github.com/coquifrogs/) for updating the HTTP status code logic 33 | -------------------------------------------------------------------------------- /googleanalyticsv3.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/googleanalyticsv3.unitypackage -------------------------------------------------------------------------------- /iOS Extras/PostprocessBuildPlayer_GA: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | #Add required libraries to Xcode project during build for Google Analytics 4 | from mod_pbxproj import * 5 | from os import path, listdir 6 | from shutil import copytree 7 | import sys 8 | 9 | frameworks = [ 10 | 'AdSupport.framework', 11 | 'CoreData.framework', 12 | 'SystemConfiguration.framework', 13 | 'libz.dylib', 14 | 'libsqlite3.dylib' 15 | ] 16 | 17 | framework_dir = path.join(sys.argv[0],'..','..','Plugins','iOS') 18 | 19 | 20 | 21 | pbx_file_path = sys.argv[1] + '/Unity-iPhone.xcodeproj/project.pbxproj' 22 | pbx_object = XcodeProject.Load(pbx_file_path) 23 | 24 | pbx_object.add_framework_search_paths([path.abspath(framework_dir)]) 25 | 26 | for framework in frameworks: 27 | pbx_object.add_file('System/Library/' + framework, tree='SDKROOT') 28 | 29 | pbx_object.save() 30 | -------------------------------------------------------------------------------- /source/Editor/PostprocessBuildPlayer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Runs post-process build scripts. 4 | #Must follow naming convention PostprocessBuildPlayer_* and be kept in the Assets/Editor folder. 5 | 6 | echo "Running post-process build scripts." 7 | for script in `/bin/ls -1 Assets/Editor | grep -i ^postprocessbuildplayer_ | grep -v [.]meta$`; do 8 | chmod +x "Assets/Editor/$script" 9 | echo "[[[ $script ]]]" 10 | "Assets/Editor/$script" "$@" 11 | done -------------------------------------------------------------------------------- /source/GoogleAnalytics/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49640e8601cf2402d96b1b4bad2921df 3 | folderAsset: yes 4 | timeCreated: 1452209312 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /source/GoogleAnalytics/Editor/GoogleAnalyticsDependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 18 | 19 | 26 | 27 | extra-google-m2repository 28 | 29 | 31 | 32 | https://maven.google.com 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/PlayServicesResolver/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df4c76149ebac4545b77cdd15456ad8b 3 | folderAsset: yes 4 | timeCreated: 1448926516 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /source/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.56.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.56.0.dll -------------------------------------------------------------------------------- /source/PlayServicesResolver/Editor/Google.JarResolver_v1.2.56.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/PlayServicesResolver/Editor/Google.JarResolver_v1.2.56.0.dll -------------------------------------------------------------------------------- /source/PlayServicesResolver/Editor/Google.VersionHandler.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/PlayServicesResolver/Editor/Google.VersionHandler.dll -------------------------------------------------------------------------------- /source/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.56.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.56.0.dll -------------------------------------------------------------------------------- /source/PlayServicesResolver/Editor/play-services-resolver_v1.2.56.0.txt: -------------------------------------------------------------------------------- 1 | Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.56.0.dll 2 | Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.56.0.dll 3 | Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll 4 | Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.56.0.dll 5 | -------------------------------------------------------------------------------- /source/Plugins/Android/libGoogleAnalyticsServices.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/Plugins/Android/libGoogleAnalyticsServices.jar -------------------------------------------------------------------------------- /source/Plugins/Android/readme.txt: -------------------------------------------------------------------------------- 1 | This directory will beautomatically populated with files using the JAR resolver. 2 | -------------------------------------------------------------------------------- /source/Plugins/Editor/AdvertiserOptIn.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | @CustomPropertyDrawer(AdvertiserOptInAttribute) 18 | class AdvertiserOptInDrawer extends PropertyDrawer { 19 | 20 | function OnGUI(position : Rect, property : SerializedProperty, label : GUIContent) { 21 | 22 | // TODO: I don't like this, but guilayout was not cooperating, revisit later. 23 | var indent = 25; 24 | var row1 = position.y + 15; 25 | var row2 = row1 + 25; 26 | var row3 = row2 + 85; 27 | 28 | EditorGUI.LabelField(Rect(position.x, row1, 155, 25), "Advertiser Id Support"); 29 | 30 | var style = new GUIStyle(EditorStyles.textArea); 31 | style.wordWrap = true; 32 | 33 | EditorGUI.TextArea(Rect(position.x+indent, row2, position.width - 40, 75), "If you enable this collection, ensure that you review and adhere to the Google Analytics policies for SDKs and advertising features. Click the button below to view them in your browser.", style); 34 | EditorGUI.LabelField(Rect(position.x+indent, row3, 155, 25), "Send IDFA/AdID"); 35 | EditorGUI.PropertyField(Rect(position.x+125, row3, 15, 25), property, GUIContent.none); 36 | 37 | if(GUI.Button(Rect(position.x+150, row3 - 5, 115, 25), "View GA Policies")) { 38 | Application.OpenURL("https://support.google.com/analytics/answer/2700409"); 39 | } 40 | } 41 | 42 | function GetPropertyHeight (property : SerializedProperty, label : GUIContent) { 43 | var height = EditorGUI.GetPropertyHeight(property, label); 44 | return height + 140; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/Plugins/Editor/RangedTooltipDrawer.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /** 18 | * Custom Property Drawer for Ranged inspector properties that also 19 | * have a tooltip 20 | * 21 | **/ 22 | @CustomPropertyDrawer(RangedTooltipAttribute) 23 | class RangedTooltipDrawer extends PropertyDrawer { 24 | 25 | // Draw the property inside the given rect 26 | function OnGUI(position : Rect, property : SerializedProperty, 27 | label : GUIContent) { 28 | // First get the attribute since it contains the range for the slider 29 | var range : RangedTooltipAttribute = attribute as RangedTooltipAttribute; 30 | var content = new GUIContent(label.text, range.text); 31 | 32 | if (property.propertyType == SerializedPropertyType.Float) { 33 | EditorGUI.Slider(position, property, range.min, range.max, content); 34 | } else if (property.propertyType == SerializedPropertyType.Integer) { 35 | EditorGUI.IntSlider(position, property, range.min, range.max, content); 36 | } else { 37 | EditorGUI.LabelField(position, label.text, 38 | 'Use Range with float or int.'); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Plugins/Editor/TooltipDrawer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 18 | #define PRE_UNITY_4_3 19 | #endif 20 | 21 | using System; 22 | using System.Reflection; 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | 27 | /* 28 | Custom Property Drawer to enable Tooltips for Inspector properties 29 | */ 30 | 31 | [CustomPropertyDrawer(typeof(TooltipAttribute))] 32 | public class TooltipDrawer : PropertyDrawer 33 | { 34 | 35 | #if PRE_UNITY_4_3 36 | private GUIContent _newTooltipContent = null; 37 | private GUIContent previousTooltipContent = null; 38 | private Type fieldType = null; 39 | 40 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent tooltipContent) { 41 | previousTooltipContent = tooltipContent; 42 | EditorGUI.BeginProperty(position, newTooltipContent, property); 43 | EditorGUI.BeginChangeCheck(); 44 | switch(property.propertyType) 45 | { 46 | case SerializedPropertyType.Boolean: 47 | bool newBoolValue = EditorGUI.Toggle(position, newTooltipContent, property.boolValue); 48 | if(EditorGUI.EndChangeCheck()) property.boolValue = newBoolValue; 49 | break; 50 | case SerializedPropertyType.Enum: 51 | int newEnumValueIndex = (int)(object)EditorGUI.EnumPopup(position, newTooltipContent, Enum.Parse(GetFieldType(property), property.enumNames[property.enumValueIndex]) as Enum); 52 | if(EditorGUI.EndChangeCheck()) property.enumValueIndex = newEnumValueIndex; 53 | break; 54 | case SerializedPropertyType.Float: 55 | float newFloatValue = EditorGUI.FloatField(position, newTooltipContent, property.floatValue); 56 | if(EditorGUI.EndChangeCheck()) property.floatValue = newFloatValue; 57 | break; 58 | case SerializedPropertyType.Integer: 59 | int newIntValue = EditorGUI.IntField(position, newTooltipContent, property.intValue); 60 | if(EditorGUI.EndChangeCheck()) property.intValue = newIntValue; 61 | break; 62 | case SerializedPropertyType.String: 63 | string newStringValue = EditorGUI.TextField(position, newTooltipContent, property.stringValue); 64 | if(EditorGUI.EndChangeCheck()) property.stringValue = newStringValue; 65 | break; 66 | default: 67 | Debug.LogWarning("TooltipDrawer: Unsupported Type: " + property.propertyType); 68 | break; 69 | } 70 | } 71 | 72 | private GUIContent newTooltipContent { 73 | get { 74 | if(_newTooltipContent == null) { 75 | TooltipAttribute tooltipAttribute = attribute as TooltipAttribute; 76 | _newTooltipContent = new GUIContent(previousTooltipContent.text, tooltipAttribute.text); 77 | } 78 | return _newTooltipContent; 79 | } 80 | } 81 | 82 | private Type GetFieldType(SerializedProperty property) { 83 | if (fieldType == null) { 84 | Type parentClassType = property.serializedObject.targetObject.GetType(); 85 | FieldInfo fieldInfo = parentClassType.GetField(property.name, 86 | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); 87 | 88 | if (fieldInfo == null) { 89 | Debug.LogWarning("TooltipDrawer: No field info found."); 90 | return null; 91 | } 92 | fieldType = fieldInfo.FieldType; 93 | } 94 | return fieldType; 95 | } 96 | 97 | #else 98 | 99 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent tooltipContent) { 100 | var atr = (TooltipAttribute) attribute; 101 | var content = new GUIContent(tooltipContent.text, atr.text); 102 | EditorGUI.PropertyField(position, property, content); 103 | } 104 | 105 | #endif 106 | } 107 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/Attributes/RangedTooltipAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | 19 | /* 20 | Ranged Tooltip attribute for displaying properties with range and 21 | a tooltip in the inspector. 22 | */ 23 | public class RangedTooltipAttribute : PropertyAttribute { 24 | public readonly float min; 25 | public readonly float max; 26 | public readonly string text; 27 | 28 | public RangedTooltipAttribute(string text, float min, float max) { 29 | this.text = text; 30 | this.min = min; 31 | this.max = max; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/Attributes/TooltipAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | 19 | /* 20 | Tooltip attribute for displaying Tooltips in the inspector. 21 | */ 22 | public class TooltipAttribute : PropertyAttribute { 23 | public readonly string text; 24 | 25 | public TooltipAttribute(string text) { 26 | this.text = text; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/Field.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | public class Field { 18 | 19 | private readonly string parameter; 20 | 21 | public Field(string parameter){ 22 | this.parameter = parameter; 23 | } 24 | 25 | public override string ToString(){ 26 | return parameter; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/Fields.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | 20 | /* 21 | Available fields to use with SetOnTracker(Field fieldName, object value) 22 | */ 23 | public class Fields { 24 | 25 | //General 26 | public readonly static Field ANONYMIZE_IP = new Field("&aip"); 27 | public readonly static Field HIT_TYPE = new Field("&t"); 28 | public readonly static Field SESSION_CONTROL = new Field("&sc"); 29 | 30 | public readonly static Field SCREEN_NAME = new Field("&cd"); 31 | public readonly static Field LOCATION = new Field("&dl"); 32 | public readonly static Field REFERRER = new Field("&dr"); 33 | public readonly static Field PAGE = new Field("&dp"); 34 | public readonly static Field HOSTNAME = new Field("&dh"); 35 | public readonly static Field TITLE = new Field("&dt"); 36 | public readonly static Field LANGUAGE = new Field("&ul"); 37 | public readonly static Field ENCODING = new Field("&de"); 38 | 39 | // System 40 | public readonly static Field SCREEN_COLORS = new Field("&sd"); 41 | public readonly static Field SCREEN_RESOLUTION = new Field("&sr"); 42 | public readonly static Field VIEWPORT_SIZE = new Field("&vp"); 43 | 44 | // Application 45 | public readonly static Field APP_NAME = new Field("&an"); 46 | public readonly static Field APP_ID = new Field("&aid"); 47 | public readonly static Field APP_INSTALLER_ID = new Field("&aiid"); 48 | public readonly static Field APP_VERSION = new Field("&av"); 49 | 50 | // Visitor 51 | public readonly static Field CLIENT_ID = new Field("&cid"); 52 | public readonly static Field USER_ID = new Field("&uid"); 53 | 54 | // Campaign related fields; used in all hits. 55 | public readonly static Field CAMPAIGN_NAME = new Field("&cn"); 56 | public readonly static Field CAMPAIGN_SOURCE = new Field("&cs"); 57 | public readonly static Field CAMPAIGN_MEDIUM = new Field("&cm"); 58 | public readonly static Field CAMPAIGN_KEYWORD = new Field("&ck"); 59 | public readonly static Field CAMPAIGN_CONTENT = new Field("&cc"); 60 | public readonly static Field CAMPAIGN_ID = new Field("&ci"); 61 | // Autopopulated campaign fields 62 | public readonly static Field GCLID = new Field("&gclid"); 63 | public readonly static Field DCLID = new Field("&dclid"); 64 | 65 | 66 | // Event Hit (&t=event) 67 | public readonly static Field EVENT_CATEGORY = new Field("&ec"); 68 | public readonly static Field EVENT_ACTION = new Field("&ea"); 69 | public readonly static Field EVENT_LABEL = new Field("&el"); 70 | public readonly static Field EVENT_VALUE = new Field("&ev"); 71 | 72 | // Social Hit (&t=social) 73 | public readonly static Field SOCIAL_NETWORK = new Field("&sn"); 74 | public readonly static Field SOCIAL_ACTION = new Field("&sa"); 75 | public readonly static Field SOCIAL_TARGET = new Field("&st"); 76 | 77 | // Timing Hit (&t=timing) 78 | public readonly static Field TIMING_VAR = new Field("&utv"); 79 | public readonly static Field TIMING_VALUE = new Field("&utt"); 80 | public readonly static Field TIMING_CATEGORY = new Field("&utc"); 81 | public readonly static Field TIMING_LABEL = new Field("&utl"); 82 | 83 | 84 | // Exception Hit (&t=exception) 85 | public readonly static Field EX_DESCRIPTION = new Field("&exd"); 86 | public readonly static Field EX_FATAL = new Field("&exf"); 87 | 88 | // Ecommerce (&t=transaction / &t=item) 89 | public readonly static Field CURRENCY_CODE = new Field("&cu"); 90 | public readonly static Field TRANSACTION_ID = new Field("&ti"); 91 | public readonly static Field TRANSACTION_AFFILIATION = new Field("&ta"); 92 | public readonly static Field TRANSACTION_SHIPPING = new Field("&ts"); 93 | public readonly static Field TRANSACTION_TAX = new Field("&tt"); 94 | public readonly static Field TRANSACTION_REVENUE = new Field("&tr"); 95 | public readonly static Field ITEM_SKU = new Field("&ic"); 96 | public readonly static Field ITEM_NAME = new Field("&in"); 97 | public readonly static Field ITEM_CATEGORY = new Field("&iv"); 98 | public readonly static Field ITEM_PRICE = new Field("&ip"); 99 | public readonly static Field ITEM_QUANTITY = new Field("&iq"); 100 | 101 | // General Configuration 102 | public readonly static Field TRACKING_ID = new Field("&tid"); 103 | public readonly static Field SAMPLE_RATE = new Field("&sf"); 104 | public readonly static Field DEVELOPER_ID = new Field("&did"); 105 | 106 | public readonly static Field CUSTOM_METRIC = new Field("&cm"); 107 | public readonly static Field CUSTOM_DIMENSION = new Field("&cd"); 108 | } 109 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/GAIHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Runtime.InteropServices; 21 | 22 | /* 23 | Wrapper for Objective-C iOS SDK 24 | */ 25 | public class GAIHandler { 26 | #if UNITY_IPHONE && !UNITY_EDITOR 27 | [DllImport("__Internal")] 28 | private static extern void setOptOut(bool optOut); 29 | public void _setOptOut(bool optOut){ 30 | setOptOut(optOut); 31 | } 32 | 33 | [DllImport("__Internal")] 34 | private static extern void setDispatchInterval(int time); 35 | public void _setDispatchInterval(int time){ 36 | setDispatchInterval(time); 37 | } 38 | 39 | [DllImport("__Internal")] 40 | private static extern void anonymizeIP(); 41 | public void _anonymizeIP(){ 42 | anonymizeIP(); 43 | } 44 | 45 | [DllImport("__Internal")] 46 | private static extern void setTrackUncaughtExceptions(bool trackUncaughtExceptions); 47 | public void _setTrackUncaughtExceptions(bool trackUncaughtExceptions){ 48 | setTrackUncaughtExceptions(trackUncaughtExceptions); 49 | } 50 | 51 | [DllImport("__Internal")] 52 | private static extern void setDryRun(bool dryRun); 53 | public void _setDryRun(bool dryRun){ 54 | setDryRun(dryRun); 55 | } 56 | 57 | [DllImport("__Internal")] 58 | private static extern void setSampleFrequency(int sampleFrequency); 59 | public void _setSampleFrequency(int sampleFrequency){ 60 | setSampleFrequency(sampleFrequency); 61 | } 62 | 63 | [DllImport("__Internal")] 64 | private static extern void setLogLevel(int logLevel); 65 | public void _setLogLevel(int logLevel){ 66 | setLogLevel(logLevel); 67 | } 68 | 69 | [DllImport("__Internal")] 70 | private static extern void startSession(); 71 | public void _startSession(){ 72 | startSession(); 73 | } 74 | 75 | [DllImport("__Internal")] 76 | private static extern void stopSession(); 77 | public void _stopSession(){ 78 | stopSession(); 79 | } 80 | 81 | [DllImport("__Internal")] 82 | private static extern IntPtr trackerWithName(string name, string trackingId); 83 | public IntPtr _getTrackerWithName(string name, string trackingId){ 84 | return trackerWithName(name, trackingId); 85 | } 86 | 87 | [DllImport("__Internal")] 88 | private static extern IntPtr trackerWithTrackingId(string trackingId); 89 | public IntPtr _getTrackerWithTrackingId(string trackingId){ 90 | return trackerWithTrackingId(trackingId); 91 | } 92 | 93 | [DllImport("__Internal")] 94 | private static extern void set(string parameterName, string value); 95 | public void _set(string parameterName, object value){ 96 | set(parameterName, value.ToString()); 97 | } 98 | 99 | [DllImport("__Internal")] 100 | private static extern void setBool(string parameterName, bool value); 101 | public void _setBool(string parameterName, bool value){ 102 | setBool(parameterName, value); 103 | } 104 | 105 | [DllImport("__Internal")] 106 | private static extern string get(string parameterName); 107 | public string _get(string parameterName){ 108 | return get(parameterName); 109 | } 110 | 111 | [DllImport("__Internal")] 112 | private static extern void dispatch(); 113 | public void _dispatchHits(){ 114 | dispatch(); 115 | } 116 | 117 | [DllImport("__Internal")] 118 | private static extern void sendAppView(string screenName); 119 | public void _sendAppView(AppViewHitBuilder builder){ 120 | _buildCustomMetricsDictionary(builder); 121 | _buildCustomDimensionsDictionary(builder); 122 | _buildCampaignParametersDictionary(builder); 123 | sendAppView(builder.GetScreenName()); 124 | } 125 | 126 | [DllImport("__Internal")] 127 | private static extern void sendEvent(string category, string action, string label, long value); 128 | public void _sendEvent(EventHitBuilder builder){ 129 | _buildCustomMetricsDictionary(builder); 130 | _buildCustomDimensionsDictionary(builder); 131 | _buildCampaignParametersDictionary(builder); 132 | sendEvent(builder.GetEventCategory(), builder.GetEventAction(), builder.GetEventLabel(), builder.GetEventValue()); 133 | } 134 | 135 | [DllImport("__Internal")] 136 | private static extern void sendTransaction(string transactionID, string affiliation, double revenue, double tax, double shipping, string currencyCode); 137 | public void _sendTransaction(TransactionHitBuilder builder){ 138 | _buildCustomMetricsDictionary(builder); 139 | _buildCustomDimensionsDictionary(builder); 140 | _buildCampaignParametersDictionary(builder); 141 | sendTransaction(builder.GetTransactionID(), builder.GetAffiliation(), builder.GetRevenue(), builder.GetTax(), builder.GetShipping(), builder.GetCurrencyCode()); 142 | } 143 | 144 | [DllImport("__Internal")] 145 | private static extern void sendItemWithTransaction(string transactionID, string name, string sku, string category, double price, long quantity, string currencyCode); 146 | public void _sendItemWithTransaction(ItemHitBuilder builder){ 147 | _buildCustomMetricsDictionary(builder); 148 | _buildCustomDimensionsDictionary(builder); 149 | _buildCampaignParametersDictionary(builder); 150 | sendItemWithTransaction(builder.GetTransactionID(), builder.GetName(), builder.GetSKU(), builder.GetCategory(), builder.GetPrice(), builder.GetQuantity(),builder.GetCurrencyCode()); 151 | } 152 | 153 | [DllImport("__Internal")] 154 | private static extern void sendException(string exceptionDescription, bool isFatal); 155 | public void _sendException(ExceptionHitBuilder builder){ 156 | _buildCustomMetricsDictionary(builder); 157 | _buildCustomDimensionsDictionary(builder); 158 | _buildCampaignParametersDictionary(builder); 159 | sendException(builder.GetExceptionDescription(), builder.IsFatal()); 160 | } 161 | 162 | [DllImport("__Internal")] 163 | private static extern void sendSocial(string socialNetwork, string socialAction, string targetUrl); 164 | public void _sendSocial(SocialHitBuilder builder){ 165 | _buildCustomMetricsDictionary(builder); 166 | _buildCustomDimensionsDictionary(builder); 167 | _buildCampaignParametersDictionary(builder); 168 | sendSocial(builder.GetSocialNetwork(), builder.GetSocialAction(), builder.GetSocialTarget()); 169 | } 170 | 171 | [DllImport("__Internal")] 172 | private static extern void sendTiming(string timingCategory,long timingInterval, string timingName, string timingLabel); 173 | public void _sendTiming(TimingHitBuilder builder){ 174 | _buildCustomMetricsDictionary(builder); 175 | _buildCustomDimensionsDictionary(builder); 176 | _buildCampaignParametersDictionary(builder); 177 | sendTiming(builder.GetTimingCategory(), builder.GetTimingInterval(), builder.GetTimingName(), builder.GetTimingLabel()); 178 | } 179 | 180 | [DllImport("__Internal")] 181 | private static extern void addCustomDimensionToDictionary(int key, string value); 182 | public void _buildCustomDimensionsDictionary(HitBuilder builder){ 183 | foreach(KeyValuePair entry in builder.GetCustomDimensions()) 184 | { 185 | addCustomDimensionToDictionary(entry.Key, entry.Value); 186 | } 187 | } 188 | 189 | [DllImport("__Internal")] 190 | private static extern void addCustomMetricToDictionary(int key, string value); 191 | public void _buildCustomMetricsDictionary(HitBuilder builder){ 192 | foreach(KeyValuePair entry in builder.GetCustomMetrics()) 193 | { 194 | addCustomMetricToDictionary(entry.Key, entry.Value); 195 | } 196 | } 197 | 198 | [DllImport("__Internal")] 199 | private static extern void buildCampaignParametersDictionary(string source, string medium, string name, string content, string keyword); 200 | public void _buildCampaignParametersDictionary(HitBuilder builder){ 201 | if(!String.IsNullOrEmpty(builder.GetCampaignSource())){ 202 | buildCampaignParametersDictionary(builder.GetCampaignSource(), 203 | builder.GetCampaignMedium() != null ? builder.GetCampaignMedium() : "", 204 | builder.GetCampaignName() != null? builder.GetCampaignName() : "", 205 | builder.GetCampaignContent() != null? builder.GetCampaignContent() : "", 206 | builder.GetCampaignKeyword() != null? builder.GetCampaignKeyword() : ""); 207 | } else if(!String.IsNullOrEmpty(builder.GetCampaignMedium()) || 208 | !String.IsNullOrEmpty(builder.GetCampaignName()) || 209 | !String.IsNullOrEmpty(builder.GetCampaignMedium()) || 210 | !String.IsNullOrEmpty(builder.GetCampaignContent()) || 211 | !String.IsNullOrEmpty(builder.GetCampaignKeyword())) { 212 | Debug.Log("A required parameter (campaign source) is null or empty. No campaign parameters will be added to hit."); 213 | } 214 | } 215 | #endif 216 | } 217 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/GAv3.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/Plugins/GoogleAnalyticsV3/GAv3.prefab -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/GoogleAnalyticsiOSV3.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System; 19 | using System.Collections.Generic; 20 | 21 | /* 22 | GoogleAnalyticsiOSV3 handles building hits using the iOS SDK. 23 | Developers should call the methods in GoogleAnalyticsV3, which will call the 24 | appropriate methods in this class if the application is built for iOS. 25 | */ 26 | public class GoogleAnalyticsiOSV3 { 27 | 28 | #if UNITY_IPHONE && !UNITY_EDITOR 29 | private string trackingCode; 30 | private string appName; 31 | private string bundleIdentifier; 32 | private string appVersion; 33 | private int dispatchPeriod; 34 | private int sampleFrequency; 35 | private GoogleAnalyticsV3.DebugMode logLevel; 36 | private bool anonymizeIP; 37 | private bool dryRun; 38 | private GAIHandler handler; 39 | 40 | internal void InitializeTracker () { 41 | Debug.Log ("Initializing Google Analytics iOS Tracker."); 42 | handler = new GAIHandler(); 43 | handler._setDispatchInterval(dispatchPeriod); 44 | handler._setDryRun(dryRun); 45 | handler._setTrackUncaughtExceptions(true); 46 | SetLogLevel(logLevel); 47 | handler._getTrackerWithTrackingId(trackingCode); 48 | 49 | handler._setSampleFrequency(sampleFrequency); 50 | SetTrackerVal(Fields.APP_NAME, appName); 51 | SetTrackerVal(Fields.APP_ID, bundleIdentifier); 52 | SetTrackerVal(Fields.APP_VERSION, appVersion); 53 | if(anonymizeIP) { 54 | handler._anonymizeIP(); 55 | } 56 | } 57 | 58 | private void SetLogLevel(GoogleAnalyticsV3.DebugMode logLevel) { 59 | switch(logLevel) 60 | { 61 | case GoogleAnalyticsV3.DebugMode.ERROR: 62 | handler._setLogLevel(1); 63 | break; 64 | case GoogleAnalyticsV3.DebugMode.VERBOSE: 65 | handler._setLogLevel(4); 66 | break; 67 | case GoogleAnalyticsV3.DebugMode.INFO: 68 | handler._setLogLevel(3); 69 | break; 70 | default: 71 | handler._setLogLevel(2); 72 | break; 73 | } 74 | } 75 | 76 | public void ClearUserIDOverride() { 77 | SetTrackerVal(Fields.USER_ID, null); 78 | } 79 | 80 | public void DispatchHits(){ 81 | handler._dispatchHits(); 82 | } 83 | 84 | public void StartSession(){ 85 | handler._startSession(); 86 | } 87 | 88 | public void StopSession(){ 89 | handler._stopSession(); 90 | } 91 | 92 | public void LogScreen(AppViewHitBuilder builder){ 93 | handler._sendAppView(builder); 94 | } 95 | 96 | public void LogEvent(EventHitBuilder builder){ 97 | handler._sendEvent(builder); 98 | } 99 | 100 | internal void LogTransaction(TransactionHitBuilder builder) { 101 | handler._sendTransaction(builder); 102 | } 103 | 104 | internal void LogItem(ItemHitBuilder builder) { 105 | handler._sendItemWithTransaction(builder); 106 | } 107 | 108 | public void LogException(ExceptionHitBuilder builder) { 109 | handler._sendException(builder); 110 | } 111 | 112 | public void LogSocial(SocialHitBuilder builder) { 113 | handler._sendSocial(builder); 114 | } 115 | 116 | public void LogTiming(TimingHitBuilder builder) { 117 | handler._sendTiming(builder); 118 | } 119 | 120 | public void SetOptOut(bool optOut) { 121 | handler._setOptOut(optOut); 122 | } 123 | 124 | public void SetTrackerVal(Field fieldName, object value){ 125 | handler._set(fieldName.ToString(), value); 126 | } 127 | 128 | public void SetTrackingCode(string trackingCode) { 129 | this.trackingCode = trackingCode; 130 | } 131 | 132 | public void SetAppName(string appName) { 133 | this.appName = appName; 134 | } 135 | 136 | public void SetBundleIdentifier(string bundleIdentifier) { 137 | this.bundleIdentifier = bundleIdentifier; 138 | } 139 | 140 | public void SetAppVersion(string appVersion) { 141 | this.appVersion = appVersion; 142 | } 143 | 144 | public void SetDispatchPeriod(int dispatchPeriod) { 145 | this.dispatchPeriod = dispatchPeriod; 146 | } 147 | 148 | public void SetSampleFrequency(int sampleFrequency) { 149 | this.sampleFrequency = sampleFrequency; 150 | } 151 | 152 | public void SetLogLevelValue(GoogleAnalyticsV3.DebugMode logLevel) { 153 | this.logLevel = logLevel; 154 | } 155 | 156 | public void SetAnonymizeIP(bool anonymizeIP) { 157 | this.anonymizeIP = anonymizeIP; 158 | } 159 | 160 | public void SetDryRun(bool dryRun) { 161 | this.dryRun = dryRun; 162 | } 163 | 164 | #endif 165 | } 166 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/AppViewHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class AppViewHitBuilder : HitBuilder { 23 | 24 | private string screenName = ""; 25 | 26 | public string GetScreenName() { 27 | return screenName; 28 | } 29 | 30 | public AppViewHitBuilder SetScreenName(string screenName) { 31 | if (screenName != null) { 32 | this.screenName = screenName; 33 | } 34 | return this; 35 | } 36 | 37 | public override AppViewHitBuilder GetThis() { 38 | return this; 39 | } 40 | 41 | public override AppViewHitBuilder Validate() { 42 | if (String.IsNullOrEmpty(screenName)) { 43 | Debug.Log("No screen name provided - App View hit cannot be sent."); 44 | return null; 45 | } 46 | return this; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/EventHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class EventHitBuilder : HitBuilder { 23 | 24 | private string eventCategory = ""; 25 | private string eventAction = ""; 26 | private string eventLabel = ""; 27 | private long eventValue; 28 | 29 | public string GetEventCategory() { 30 | return eventCategory; 31 | } 32 | 33 | public EventHitBuilder SetEventCategory(string eventCategory) { 34 | if (eventCategory != null) { 35 | this.eventCategory = eventCategory; 36 | } 37 | return this; 38 | } 39 | 40 | public string GetEventAction() { 41 | return eventAction; 42 | } 43 | 44 | public EventHitBuilder SetEventAction(string eventAction) { 45 | if (eventAction != null) { 46 | this.eventAction = eventAction; 47 | } 48 | return this; 49 | } 50 | 51 | public string GetEventLabel() { 52 | return eventLabel; 53 | } 54 | 55 | public EventHitBuilder SetEventLabel(string eventLabel) { 56 | if (eventLabel != null) { 57 | this.eventLabel = eventLabel; 58 | } 59 | return this; 60 | } 61 | 62 | public long GetEventValue() { 63 | return eventValue; 64 | } 65 | 66 | public EventHitBuilder SetEventValue(long eventValue) { 67 | this.eventValue = eventValue; 68 | return this; 69 | } 70 | 71 | public override EventHitBuilder GetThis() { 72 | return this; 73 | } 74 | 75 | public override EventHitBuilder Validate() { 76 | if (String.IsNullOrEmpty(eventCategory)) { 77 | Debug.LogWarning("No event category provided - Event hit cannot be sent."); 78 | return null; 79 | } 80 | if (String.IsNullOrEmpty(eventAction)) { 81 | Debug.LogWarning("No event action provided - Event hit cannot be sent."); 82 | return null; 83 | } 84 | return this; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/ExceptionHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class ExceptionHitBuilder : HitBuilder { 23 | 24 | private string exceptionDescription = ""; 25 | private bool fatal = false; 26 | 27 | public string GetExceptionDescription(){ 28 | return exceptionDescription; 29 | } 30 | 31 | public ExceptionHitBuilder SetExceptionDescription(string exceptionDescription) { 32 | if(exceptionDescription != null){ 33 | this.exceptionDescription = exceptionDescription; 34 | } 35 | return this; 36 | } 37 | 38 | public bool IsFatal(){ 39 | return fatal; 40 | } 41 | 42 | public ExceptionHitBuilder SetFatal(bool fatal) { 43 | this.fatal = fatal; 44 | return this; 45 | } 46 | 47 | public override ExceptionHitBuilder GetThis(){ 48 | return this; 49 | } 50 | 51 | public override ExceptionHitBuilder Validate(){ 52 | return this; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/HitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | 21 | /* 22 | Base class for building hits. This class stores data which can be sent with 23 | any hit type but cannot be sent independent of other hits. 24 | */ 25 | public abstract class HitBuilder { 26 | 27 | private Dictionary customDimensions = 28 | new Dictionary(); 29 | private Dictionary customMetrics = new Dictionary(); 30 | 31 | private string campaignName = ""; 32 | private string campaignSource = ""; 33 | private string campaignMedium = ""; 34 | private string campaignKeyword = ""; 35 | private string campaignContent = ""; 36 | private string campaignID = ""; 37 | private string gclid = ""; 38 | private string dclid = ""; 39 | 40 | public abstract T GetThis(); 41 | public abstract T Validate(); 42 | 43 | public T SetCustomDimension(int dimensionNumber, string value) { 44 | customDimensions.Add(dimensionNumber, value); 45 | return GetThis(); 46 | } 47 | 48 | public Dictionary GetCustomDimensions() { 49 | return customDimensions; 50 | } 51 | 52 | public T SetCustomMetric(int metricNumber, string value) { 53 | customMetrics.Add(metricNumber, value); 54 | return GetThis(); 55 | } 56 | 57 | public Dictionary GetCustomMetrics() { 58 | return customMetrics; 59 | } 60 | 61 | public string GetCampaignName() { 62 | return campaignName; 63 | } 64 | 65 | public T SetCampaignName(string campaignName) { 66 | if (campaignName != null) { 67 | this.campaignName = campaignName; 68 | } 69 | return GetThis(); 70 | } 71 | 72 | public string GetCampaignSource() { 73 | return campaignSource; 74 | } 75 | 76 | public T SetCampaignSource(string campaignSource) { 77 | if (campaignSource != null) { 78 | this.campaignSource = campaignSource; 79 | } else { 80 | Debug.Log("Campaign source cannot be null or empty"); 81 | } 82 | return GetThis(); 83 | } 84 | 85 | public string GetCampaignMedium() { 86 | return campaignMedium; 87 | } 88 | 89 | public T SetCampaignMedium(string campaignMedium) { 90 | if (campaignMedium != null) { 91 | this.campaignMedium = campaignMedium; 92 | } 93 | return GetThis(); 94 | } 95 | 96 | public string GetCampaignKeyword() { 97 | return campaignKeyword; 98 | } 99 | 100 | public T SetCampaignKeyword(string campaignKeyword) { 101 | if (campaignKeyword != null) { 102 | this.campaignKeyword = campaignKeyword; 103 | } 104 | return GetThis(); 105 | } 106 | 107 | public string GetCampaignContent() { 108 | return campaignContent; 109 | } 110 | 111 | public T SetCampaignContent(string campaignContent) { 112 | if (campaignContent != null) { 113 | this.campaignContent = campaignContent; 114 | } 115 | return GetThis(); 116 | } 117 | 118 | public string GetCampaignID() { 119 | return campaignID; 120 | } 121 | 122 | public T SetCampaignID(string campaignID) { 123 | if (campaignID != null) { 124 | this.campaignID = campaignID; 125 | } 126 | return GetThis(); 127 | } 128 | 129 | public string GetGclid() { 130 | return gclid; 131 | } 132 | 133 | public T SetGclid(string gclid) { 134 | if (gclid != null) { 135 | this.gclid = gclid; 136 | } 137 | return GetThis(); 138 | } 139 | 140 | public string GetDclid() { 141 | return dclid; 142 | } 143 | 144 | public T SetDclid(string dclid) { 145 | if (dclid != null) { 146 | this.dclid = dclid; 147 | } 148 | return GetThis(); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/ItemHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class ItemHitBuilder : HitBuilder { 23 | 24 | private string transactionID = ""; 25 | private string name = ""; 26 | private string SKU = ""; 27 | private double price; 28 | private string category = ""; 29 | private long quantity; 30 | private string currencyCode = ""; 31 | 32 | public string GetTransactionID() { 33 | return transactionID; 34 | } 35 | 36 | public ItemHitBuilder SetTransactionID(string transactionID) { 37 | if(transactionID != null){ 38 | this.transactionID = transactionID; 39 | } 40 | return this; 41 | } 42 | 43 | public string GetName() { 44 | return name; 45 | } 46 | 47 | public ItemHitBuilder SetName(string name) { 48 | if(name != null){ 49 | this.name = name; 50 | } 51 | return this; 52 | } 53 | 54 | public string GetSKU() { 55 | return name; 56 | } 57 | 58 | public ItemHitBuilder SetSKU(string SKU) { 59 | if(SKU != null){ 60 | this.SKU = SKU; 61 | } 62 | return this; 63 | } 64 | 65 | public double GetPrice() { 66 | return price; 67 | } 68 | 69 | public ItemHitBuilder SetPrice(double price) { 70 | this.price = price; 71 | return this; 72 | } 73 | 74 | public string GetCategory() { 75 | return category; 76 | } 77 | 78 | public ItemHitBuilder SetCategory(string category) { 79 | if(category != null){ 80 | this.category = category; 81 | } 82 | return this; 83 | } 84 | 85 | public long GetQuantity() { 86 | return quantity; 87 | } 88 | 89 | public ItemHitBuilder SetQuantity(long quantity) { 90 | this.quantity = quantity; 91 | return this; 92 | } 93 | 94 | public string GetCurrencyCode() { 95 | return currencyCode; 96 | } 97 | 98 | public ItemHitBuilder SetCurrencyCode(string currencyCode) { 99 | if(currencyCode != null){ 100 | this.currencyCode = currencyCode; 101 | } 102 | return this; 103 | } 104 | 105 | public override ItemHitBuilder GetThis(){ 106 | return this; 107 | } 108 | 109 | public override ItemHitBuilder Validate(){ 110 | if(String.IsNullOrEmpty(transactionID)){ 111 | Debug.LogWarning("No transaction ID provided - Item hit cannot be sent."); 112 | return null; 113 | } 114 | if(String.IsNullOrEmpty(name)){ 115 | Debug.LogWarning("No name provided - Item hit cannot be sent."); 116 | return null; 117 | } 118 | if(String.IsNullOrEmpty(SKU)){ 119 | Debug.LogWarning("No SKU provided - Item hit cannot be sent."); 120 | return null; 121 | } 122 | if(price == 0.0D){ 123 | Debug.Log("Price in item hit is 0."); 124 | } 125 | if(quantity == 0L){ 126 | Debug.Log("Quantity in item hit is 0."); 127 | } 128 | return this; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/SocialHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class SocialHitBuilder : HitBuilder { 23 | 24 | private string socialNetwork = ""; 25 | private string socialAction = ""; 26 | private string socialTarget = ""; 27 | 28 | public string GetSocialNetwork(){ 29 | return socialNetwork; 30 | } 31 | 32 | public SocialHitBuilder SetSocialNetwork(string socialNetwork) { 33 | if(socialNetwork != null){ 34 | this.socialNetwork = socialNetwork; 35 | } 36 | return this; 37 | } 38 | 39 | public string GetSocialAction(){ 40 | return socialAction; 41 | } 42 | 43 | public SocialHitBuilder SetSocialAction(string socialAction) { 44 | if(socialAction != null){ 45 | this.socialAction = socialAction; 46 | } 47 | return this; 48 | } 49 | 50 | public string GetSocialTarget(){ 51 | return socialTarget; 52 | } 53 | 54 | public SocialHitBuilder SetSocialTarget(string socialTarget) { 55 | if(socialTarget != null){ 56 | this.socialTarget = socialTarget; 57 | } 58 | return this; 59 | } 60 | 61 | public override SocialHitBuilder GetThis(){ 62 | return this; 63 | } 64 | 65 | public override SocialHitBuilder Validate(){ 66 | if(String.IsNullOrEmpty(socialNetwork)){ 67 | Debug.LogError("No social network provided - Social hit cannot be sent"); 68 | return null; 69 | } 70 | if(String.IsNullOrEmpty(socialAction)){ 71 | Debug.LogError("No social action provided - Social hit cannot be sent"); 72 | return null; 73 | } 74 | if(String.IsNullOrEmpty(socialTarget)){ 75 | Debug.LogError("No social target provided - Social hit cannot be sent"); 76 | return null; 77 | } 78 | return this; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/TimingHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections.Generic; 19 | using System; 20 | 21 | public class TimingHitBuilder : HitBuilder { 22 | 23 | private string timingCategory = ""; 24 | private long timingInterval; 25 | private string timingName = ""; 26 | private string timingLabel = ""; 27 | 28 | public string GetTimingCategory(){ 29 | return timingCategory; 30 | } 31 | 32 | public TimingHitBuilder SetTimingCategory(string timingCategory) { 33 | if(timingCategory != null){ 34 | this.timingCategory = timingCategory; 35 | } 36 | return this; 37 | } 38 | 39 | public long GetTimingInterval(){ 40 | return timingInterval; 41 | } 42 | 43 | public TimingHitBuilder SetTimingInterval(long timingInterval) { 44 | this.timingInterval = timingInterval; 45 | return this; 46 | } 47 | 48 | public string GetTimingName(){ 49 | return timingName; 50 | } 51 | 52 | public TimingHitBuilder SetTimingName(string timingName) { 53 | if(timingName != null){ 54 | this.timingName = timingName; 55 | } 56 | return this; 57 | } 58 | 59 | public string GetTimingLabel(){ 60 | return timingLabel; 61 | } 62 | 63 | public TimingHitBuilder SetTimingLabel(string timingLabel) { 64 | if(timingLabel != null){ 65 | this.timingLabel = timingLabel; 66 | } 67 | return this; 68 | } 69 | 70 | public override TimingHitBuilder GetThis(){ 71 | return this; 72 | } 73 | 74 | public override TimingHitBuilder Validate(){ 75 | if(String.IsNullOrEmpty(timingCategory)){ 76 | Debug.LogError("No timing category provided - Timing hit cannot be sent"); 77 | return null; 78 | } 79 | if(timingInterval == 0L){ 80 | Debug.Log("Interval in timing hit is 0."); 81 | } 82 | return this; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV3/HitBuilders/TransactionHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class TransactionHitBuilder : HitBuilder { 23 | 24 | private string transactionID = ""; 25 | private string affiliation = ""; 26 | private double revenue; 27 | private double tax; 28 | private double shipping; 29 | private string currencyCode = ""; 30 | 31 | public string GetTransactionID() { 32 | return transactionID; 33 | } 34 | 35 | public TransactionHitBuilder SetTransactionID(string transactionID) { 36 | if(transactionID != null){ 37 | this.transactionID = transactionID; 38 | } 39 | return this; 40 | } 41 | 42 | public string GetAffiliation() { 43 | return affiliation; 44 | } 45 | 46 | public TransactionHitBuilder SetAffiliation(string affiliation) { 47 | if(affiliation != null){ 48 | this.affiliation = affiliation; 49 | } 50 | return this; 51 | } 52 | 53 | public double GetRevenue() { 54 | return revenue; 55 | } 56 | 57 | public TransactionHitBuilder SetRevenue(double revenue) { 58 | this.revenue = revenue; 59 | return this; 60 | } 61 | 62 | public double GetTax() { 63 | return tax; 64 | } 65 | 66 | public TransactionHitBuilder SetTax(double tax) { 67 | this.tax = tax; 68 | return this; 69 | } 70 | 71 | public double GetShipping() { 72 | return shipping; 73 | } 74 | 75 | public TransactionHitBuilder SetShipping(double shipping) { 76 | this.shipping = shipping; 77 | return this; 78 | } 79 | 80 | public string GetCurrencyCode() { 81 | return currencyCode; 82 | } 83 | 84 | public TransactionHitBuilder SetCurrencyCode(string currencyCode) { 85 | if(currencyCode != null){ 86 | this.currencyCode = currencyCode; 87 | } 88 | return this; 89 | } 90 | 91 | public override TransactionHitBuilder GetThis(){ 92 | return this; 93 | } 94 | 95 | public override TransactionHitBuilder Validate(){ 96 | if(String.IsNullOrEmpty(transactionID)){ 97 | Debug.LogWarning("No transaction ID provided - Transaction hit cannot be sent."); 98 | return null; 99 | } 100 | if(String.IsNullOrEmpty(affiliation)){ 101 | Debug.LogWarning("No affiliation provided - Transaction hit cannot be sent."); 102 | return null; 103 | } 104 | if(revenue == 0){ 105 | Debug.Log("Revenue in transaction hit is 0."); 106 | } 107 | if(tax == 0){ 108 | Debug.Log("Tax in transaction hit is 0."); 109 | } 110 | if(shipping == 0){ 111 | Debug.Log("Shipping in transaction hit is 0."); 112 | } 113 | return this; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/Attributes/AdvertiserOptInAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | 19 | public class AdvertiserOptInAttribute : PropertyAttribute { 20 | public AdvertiserOptInAttribute() { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/Attributes/RangedTooltipAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | 19 | /* 20 | Ranged Tooltip attribute for displaying properties with range and 21 | a tooltip in the inspector. 22 | */ 23 | public class RangedTooltipAttribute : PropertyAttribute { 24 | public readonly float min; 25 | public readonly float max; 26 | public readonly string text; 27 | 28 | public RangedTooltipAttribute(string text, float min, float max) { 29 | this.text = text; 30 | this.min = min; 31 | this.max = max; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/Attributes/TooltipAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | 19 | /* 20 | Tooltip attribute for displaying Tooltips in the inspector. 21 | */ 22 | public class TooltipAttribute : PropertyAttribute { 23 | public readonly string text; 24 | 25 | public TooltipAttribute(string text) { 26 | this.text = text; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/Field.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | public class Field { 18 | 19 | private readonly string parameter; 20 | 21 | public Field(string parameter){ 22 | this.parameter = parameter; 23 | } 24 | 25 | public override string ToString(){ 26 | return parameter; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/Fields.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | 20 | /* 21 | Available fields to use with SetOnTracker(Field fieldName, object value) 22 | */ 23 | public class Fields { 24 | 25 | //General 26 | public readonly static Field ANONYMIZE_IP = new Field("&aip"); 27 | public readonly static Field HIT_TYPE = new Field("&t"); 28 | public readonly static Field SESSION_CONTROL = new Field("&sc"); 29 | 30 | public readonly static Field SCREEN_NAME = new Field("&cd"); 31 | public readonly static Field LOCATION = new Field("&dl"); 32 | public readonly static Field REFERRER = new Field("&dr"); 33 | public readonly static Field PAGE = new Field("&dp"); 34 | public readonly static Field HOSTNAME = new Field("&dh"); 35 | public readonly static Field TITLE = new Field("&dt"); 36 | public readonly static Field LANGUAGE = new Field("&ul"); 37 | public readonly static Field ENCODING = new Field("&de"); 38 | 39 | // System 40 | public readonly static Field SCREEN_COLORS = new Field("&sd"); 41 | public readonly static Field SCREEN_RESOLUTION = new Field("&sr"); 42 | public readonly static Field VIEWPORT_SIZE = new Field("&vp"); 43 | 44 | // Application 45 | public readonly static Field APP_NAME = new Field("&an"); 46 | public readonly static Field APP_ID = new Field("&aid"); 47 | public readonly static Field APP_INSTALLER_ID = new Field("&aiid"); 48 | public readonly static Field APP_VERSION = new Field("&av"); 49 | 50 | // Visitor 51 | public readonly static Field CLIENT_ID = new Field("&cid"); 52 | public readonly static Field USER_ID = new Field("&uid"); 53 | 54 | // Campaign related fields; used in all hits. 55 | public readonly static Field CAMPAIGN_NAME = new Field("&cn"); 56 | public readonly static Field CAMPAIGN_SOURCE = new Field("&cs"); 57 | public readonly static Field CAMPAIGN_MEDIUM = new Field("&cm"); 58 | public readonly static Field CAMPAIGN_KEYWORD = new Field("&ck"); 59 | public readonly static Field CAMPAIGN_CONTENT = new Field("&cc"); 60 | public readonly static Field CAMPAIGN_ID = new Field("&ci"); 61 | // Autopopulated campaign fields 62 | public readonly static Field GCLID = new Field("&gclid"); 63 | public readonly static Field DCLID = new Field("&dclid"); 64 | 65 | 66 | // Event Hit (&t=event) 67 | public readonly static Field EVENT_CATEGORY = new Field("&ec"); 68 | public readonly static Field EVENT_ACTION = new Field("&ea"); 69 | public readonly static Field EVENT_LABEL = new Field("&el"); 70 | public readonly static Field EVENT_VALUE = new Field("&ev"); 71 | 72 | // Social Hit (&t=social) 73 | public readonly static Field SOCIAL_NETWORK = new Field("&sn"); 74 | public readonly static Field SOCIAL_ACTION = new Field("&sa"); 75 | public readonly static Field SOCIAL_TARGET = new Field("&st"); 76 | 77 | // Timing Hit (&t=timing) 78 | public readonly static Field TIMING_VAR = new Field("&utv"); 79 | public readonly static Field TIMING_VALUE = new Field("&utt"); 80 | public readonly static Field TIMING_CATEGORY = new Field("&utc"); 81 | public readonly static Field TIMING_LABEL = new Field("&utl"); 82 | 83 | 84 | // Exception Hit (&t=exception) 85 | public readonly static Field EX_DESCRIPTION = new Field("&exd"); 86 | public readonly static Field EX_FATAL = new Field("&exf"); 87 | 88 | // Ecommerce (&t=transaction / &t=item) 89 | public readonly static Field CURRENCY_CODE = new Field("&cu"); 90 | public readonly static Field TRANSACTION_ID = new Field("&ti"); 91 | public readonly static Field TRANSACTION_AFFILIATION = new Field("&ta"); 92 | public readonly static Field TRANSACTION_SHIPPING = new Field("&ts"); 93 | public readonly static Field TRANSACTION_TAX = new Field("&tt"); 94 | public readonly static Field TRANSACTION_REVENUE = new Field("&tr"); 95 | public readonly static Field ITEM_SKU = new Field("&ic"); 96 | public readonly static Field ITEM_NAME = new Field("&in"); 97 | public readonly static Field ITEM_CATEGORY = new Field("&iv"); 98 | public readonly static Field ITEM_PRICE = new Field("&ip"); 99 | public readonly static Field ITEM_QUANTITY = new Field("&iq"); 100 | 101 | // General Configuration 102 | public readonly static Field TRACKING_ID = new Field("&tid"); 103 | public readonly static Field SAMPLE_RATE = new Field("&sf"); 104 | public readonly static Field DEVELOPER_ID = new Field("&did"); 105 | 106 | public readonly static Field CUSTOM_METRIC = new Field("&cm"); 107 | public readonly static Field CUSTOM_DIMENSION = new Field("&cd"); 108 | 109 | // Advertiser Id Fields 110 | public readonly static Field ADID = new Field("&adid"); 111 | public readonly static Field IDFA = new Field("&idfa"); 112 | public readonly static Field ATE = new Field("&ate"); 113 | } 114 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/GAIHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System; 19 | using System.Collections.Generic; 20 | using System.Runtime.InteropServices; 21 | 22 | /* 23 | Wrapper for Objective-C iOS SDK 24 | */ 25 | public class GAIHandler { 26 | #if UNITY_IPHONE && !UNITY_EDITOR 27 | [DllImport("__Internal")] 28 | private static extern void setOptOut(bool optOut); 29 | public void _setOptOut(bool optOut){ 30 | setOptOut(optOut); 31 | } 32 | 33 | [DllImport("__Internal")] 34 | private static extern void setDispatchInterval(int time); 35 | public void _setDispatchInterval(int time){ 36 | setDispatchInterval(time); 37 | } 38 | 39 | [DllImport("__Internal")] 40 | private static extern void anonymizeIP(); 41 | public void _anonymizeIP(){ 42 | anonymizeIP(); 43 | } 44 | 45 | [DllImport("__Internal")] 46 | private static extern void enableIDFACollection(); 47 | public void _enableIDFACollection(){ 48 | enableIDFACollection(); 49 | } 50 | 51 | [DllImport("__Internal")] 52 | private static extern void setTrackUncaughtExceptions(bool trackUncaughtExceptions); 53 | public void _setTrackUncaughtExceptions(bool trackUncaughtExceptions){ 54 | setTrackUncaughtExceptions(trackUncaughtExceptions); 55 | } 56 | 57 | [DllImport("__Internal")] 58 | private static extern void setDryRun(bool dryRun); 59 | public void _setDryRun(bool dryRun){ 60 | setDryRun(dryRun); 61 | } 62 | 63 | [DllImport("__Internal")] 64 | private static extern void setSampleFrequency(int sampleFrequency); 65 | public void _setSampleFrequency(int sampleFrequency){ 66 | setSampleFrequency(sampleFrequency); 67 | } 68 | 69 | [DllImport("__Internal")] 70 | private static extern void setLogLevel(int logLevel); 71 | public void _setLogLevel(int logLevel){ 72 | setLogLevel(logLevel); 73 | } 74 | 75 | [DllImport("__Internal")] 76 | private static extern void startSession(); 77 | public void _startSession(){ 78 | startSession(); 79 | } 80 | 81 | [DllImport("__Internal")] 82 | private static extern void stopSession(); 83 | public void _stopSession(){ 84 | stopSession(); 85 | } 86 | 87 | [DllImport("__Internal")] 88 | private static extern IntPtr trackerWithName(string name, string trackingId); 89 | public IntPtr _getTrackerWithName(string name, string trackingId){ 90 | return trackerWithName(name, trackingId); 91 | } 92 | 93 | [DllImport("__Internal")] 94 | private static extern IntPtr trackerWithTrackingId(string trackingId); 95 | public IntPtr _getTrackerWithTrackingId(string trackingId){ 96 | return trackerWithTrackingId(trackingId); 97 | } 98 | 99 | [DllImport("__Internal")] 100 | private static extern void set(string parameterName, string value); 101 | public void _set(string parameterName, object value){ 102 | set(parameterName, value.ToString()); 103 | } 104 | 105 | [DllImport("__Internal")] 106 | private static extern void setBool(string parameterName, bool value); 107 | public void _setBool(string parameterName, bool value){ 108 | setBool(parameterName, value); 109 | } 110 | 111 | [DllImport("__Internal")] 112 | private static extern string get(string parameterName); 113 | public string _get(string parameterName){ 114 | return get(parameterName); 115 | } 116 | 117 | [DllImport("__Internal")] 118 | private static extern void dispatch(); 119 | public void _dispatchHits(){ 120 | dispatch(); 121 | } 122 | 123 | [DllImport("__Internal")] 124 | private static extern void sendAppView(string screenName); 125 | public void _sendAppView(AppViewHitBuilder builder){ 126 | _buildCustomMetricsDictionary(builder); 127 | _buildCustomDimensionsDictionary(builder); 128 | _buildCampaignParametersDictionary(builder); 129 | sendAppView(builder.GetScreenName()); 130 | } 131 | 132 | [DllImport("__Internal")] 133 | private static extern void sendEvent(string category, string action, string label, long value); 134 | public void _sendEvent(EventHitBuilder builder){ 135 | _buildCustomMetricsDictionary(builder); 136 | _buildCustomDimensionsDictionary(builder); 137 | _buildCampaignParametersDictionary(builder); 138 | sendEvent(builder.GetEventCategory(), builder.GetEventAction(), builder.GetEventLabel(), builder.GetEventValue()); 139 | } 140 | 141 | [DllImport("__Internal")] 142 | private static extern void sendTransaction(string transactionID, string affiliation, double revenue, double tax, double shipping, string currencyCode); 143 | public void _sendTransaction(TransactionHitBuilder builder){ 144 | _buildCustomMetricsDictionary(builder); 145 | _buildCustomDimensionsDictionary(builder); 146 | _buildCampaignParametersDictionary(builder); 147 | sendTransaction(builder.GetTransactionID(), builder.GetAffiliation(), builder.GetRevenue(), builder.GetTax(), builder.GetShipping(), builder.GetCurrencyCode()); 148 | } 149 | 150 | [DllImport("__Internal")] 151 | private static extern void sendItemWithTransaction(string transactionID, string name, string sku, string category, double price, long quantity, string currencyCode); 152 | public void _sendItemWithTransaction(ItemHitBuilder builder){ 153 | _buildCustomMetricsDictionary(builder); 154 | _buildCustomDimensionsDictionary(builder); 155 | _buildCampaignParametersDictionary(builder); 156 | sendItemWithTransaction(builder.GetTransactionID(), builder.GetName(), builder.GetSKU(), builder.GetCategory(), builder.GetPrice(), builder.GetQuantity(),builder.GetCurrencyCode()); 157 | } 158 | 159 | [DllImport("__Internal")] 160 | private static extern void sendException(string exceptionDescription, bool isFatal); 161 | public void _sendException(ExceptionHitBuilder builder){ 162 | _buildCustomMetricsDictionary(builder); 163 | _buildCustomDimensionsDictionary(builder); 164 | _buildCampaignParametersDictionary(builder); 165 | sendException(builder.GetExceptionDescription(), builder.IsFatal()); 166 | } 167 | 168 | [DllImport("__Internal")] 169 | private static extern void sendSocial(string socialNetwork, string socialAction, string targetUrl); 170 | public void _sendSocial(SocialHitBuilder builder){ 171 | _buildCustomMetricsDictionary(builder); 172 | _buildCustomDimensionsDictionary(builder); 173 | _buildCampaignParametersDictionary(builder); 174 | sendSocial(builder.GetSocialNetwork(), builder.GetSocialAction(), builder.GetSocialTarget()); 175 | } 176 | 177 | [DllImport("__Internal")] 178 | private static extern void sendTiming(string timingCategory,long timingInterval, string timingName, string timingLabel); 179 | public void _sendTiming(TimingHitBuilder builder){ 180 | _buildCustomMetricsDictionary(builder); 181 | _buildCustomDimensionsDictionary(builder); 182 | _buildCampaignParametersDictionary(builder); 183 | sendTiming(builder.GetTimingCategory(), builder.GetTimingInterval(), builder.GetTimingName(), builder.GetTimingLabel()); 184 | } 185 | 186 | [DllImport("__Internal")] 187 | private static extern void addCustomDimensionToDictionary(int key, string value); 188 | public void _buildCustomDimensionsDictionary(HitBuilder builder){ 189 | foreach(KeyValuePair entry in builder.GetCustomDimensions()) 190 | { 191 | addCustomDimensionToDictionary(entry.Key, entry.Value); 192 | } 193 | } 194 | 195 | [DllImport("__Internal")] 196 | private static extern void addCustomMetricToDictionary(int key, string value); 197 | public void _buildCustomMetricsDictionary(HitBuilder builder){ 198 | foreach(KeyValuePair entry in builder.GetCustomMetrics()) 199 | { 200 | addCustomMetricToDictionary(entry.Key, entry.Value.ToString()); 201 | } 202 | } 203 | 204 | [DllImport("__Internal")] 205 | private static extern void buildCampaignParametersDictionary(string source, string medium, string name, string content, string keyword); 206 | public void _buildCampaignParametersDictionary(HitBuilder builder){ 207 | if(!String.IsNullOrEmpty(builder.GetCampaignSource())){ 208 | buildCampaignParametersDictionary(builder.GetCampaignSource(), 209 | builder.GetCampaignMedium() != null ? builder.GetCampaignMedium() : "", 210 | builder.GetCampaignName() != null? builder.GetCampaignName() : "", 211 | builder.GetCampaignContent() != null? builder.GetCampaignContent() : "", 212 | builder.GetCampaignKeyword() != null? builder.GetCampaignKeyword() : ""); 213 | } else if(!String.IsNullOrEmpty(builder.GetCampaignMedium()) || 214 | !String.IsNullOrEmpty(builder.GetCampaignName()) || 215 | !String.IsNullOrEmpty(builder.GetCampaignMedium()) || 216 | !String.IsNullOrEmpty(builder.GetCampaignContent()) || 217 | !String.IsNullOrEmpty(builder.GetCampaignKeyword())) { 218 | Debug.Log("A required parameter (campaign source) is null or empty. No campaign parameters will be added to hit."); 219 | } 220 | } 221 | #endif 222 | } 223 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/GAv4.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/Plugins/GoogleAnalyticsV4/GAv4.prefab -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/GoogleAnalyticsAndroidV4.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System; 19 | using System.Collections; 20 | using System.Collections.Generic; 21 | 22 | /* 23 | GoogleAnalyticsAndroidV4 handles building hits using the Android SDK. 24 | Developers should call the methods in GoogleAnalyticsV4, which will call the 25 | appropriate methods in this class if the application is built for Android. 26 | */ 27 | public class GoogleAnalyticsAndroidV4 : IDisposable { 28 | #if UNITY_ANDROID && !UNITY_EDITOR 29 | private string trackingCode; 30 | private string appVersion; 31 | private string appName; 32 | private string bundleIdentifier; 33 | private int dispatchPeriod; 34 | private int sampleFrequency; 35 | //private GoogleAnalyticsV4.DebugMode logLevel; 36 | private bool anonymizeIP; 37 | private bool adIdCollection; 38 | private bool dryRun; 39 | private int sessionTimeout; 40 | private AndroidJavaObject tracker; 41 | private AndroidJavaObject logger; 42 | private AndroidJavaObject currentActivityObject; 43 | private AndroidJavaObject googleAnalyticsSingleton; 44 | //private bool startSessionOnNextHit = false; 45 | //private bool endSessionOnNextHit = false; 46 | 47 | internal void InitializeTracker() { 48 | Debug.Log("Initializing Google Analytics Android Tracker."); 49 | 50 | using (AndroidJavaObject googleAnalyticsClass = new AndroidJavaClass("com.google.android.gms.analytics.GoogleAnalytics")) 51 | using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { 52 | currentActivityObject = unityPlayer.GetStatic("currentActivity"); 53 | googleAnalyticsSingleton = googleAnalyticsClass.CallStatic("getInstance", currentActivityObject); 54 | 55 | tracker = googleAnalyticsSingleton.Call("newTracker", trackingCode); 56 | 57 | googleAnalyticsSingleton.Call("setLocalDispatchPeriod", dispatchPeriod); 58 | googleAnalyticsSingleton.Call("setDryRun", dryRun); 59 | 60 | tracker.Call("setSampleRate", (double)sampleFrequency); 61 | tracker.Call("setAppName", appName); 62 | tracker.Call("setAppId", bundleIdentifier); 63 | tracker.Call("setAppVersion", appVersion); 64 | tracker.Call("setAnonymizeIp", anonymizeIP); 65 | tracker.Call("enableAdvertisingIdCollection", adIdCollection); 66 | } 67 | } 68 | 69 | internal void SetTrackerVal(Field fieldName, object value) { 70 | object[] args = new object[] { fieldName.ToString(), value }; 71 | tracker.Call("set", args); 72 | } 73 | 74 | private void SetSessionOnBuilder(AndroidJavaObject hitBuilder) { 75 | } 76 | 77 | internal void StartSession() { 78 | //startSessionOnNextHit = true; 79 | } 80 | 81 | internal void StopSession() { 82 | //endSessionOnNextHit = true; 83 | } 84 | 85 | public void SetOptOut(bool optOut) { 86 | googleAnalyticsSingleton.Call("setAppOptOut", optOut); 87 | } 88 | 89 | internal void LogScreen (AppViewHitBuilder builder) { 90 | tracker.Call("setScreenName", builder.GetScreenName()); 91 | 92 | AndroidJavaObject eventBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$ScreenViewBuilder"); 93 | object[] builtScreenView = new object[] { eventBuilder.Call("build") }; 94 | tracker.Call("send", builtScreenView); 95 | } 96 | 97 | internal void LogEvent(EventHitBuilder builder) { 98 | AndroidJavaObject eventBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$EventBuilder"); 99 | eventBuilder.Call("setCategory", new object[] { builder.GetEventCategory() }); 100 | eventBuilder.Call("setAction", new object[] { builder.GetEventAction() }); 101 | eventBuilder.Call("setLabel", new object[] { builder.GetEventLabel() }); 102 | eventBuilder.Call("setValue", new object[] { builder.GetEventValue() }); 103 | 104 | foreach(KeyValuePair i in builder.GetCustomDimensions()) 105 | { 106 | eventBuilder.Call("setCustomDimension", new object[] { i.Key, i.Value }); 107 | } 108 | 109 | foreach(KeyValuePair i in builder.GetCustomMetrics()) 110 | { 111 | eventBuilder.Call("setCustomMetric", new object[] { i.Key, i.Value }); 112 | } 113 | 114 | object[] builtEvent = new object[] { eventBuilder.Call("build") }; 115 | tracker.Call("send", builtEvent); 116 | } 117 | 118 | internal void LogTransaction(TransactionHitBuilder builder) { 119 | AndroidJavaObject transactionBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$TransactionBuilder"); 120 | transactionBuilder.Call("setTransactionId", new object[] { builder.GetTransactionID() }); 121 | transactionBuilder.Call("setAffiliation", new object[] { builder.GetAffiliation() }); 122 | transactionBuilder.Call("setRevenue", new object[] { builder.GetRevenue() }); 123 | transactionBuilder.Call("setTax", new object[] { builder.GetTax() }); 124 | transactionBuilder.Call("setShipping", new object[] { builder.GetShipping() }); 125 | transactionBuilder.Call("setCurrencyCode", new object[] { builder.GetCurrencyCode() }); 126 | 127 | object[] builtTransaction = new object[] { transactionBuilder.Call("build") }; 128 | tracker.Call("send", builtTransaction); 129 | } 130 | 131 | internal void LogItem(ItemHitBuilder builder) { 132 | AndroidJavaObject itemBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$ItemBuilder"); 133 | itemBuilder.Call("setTransactionId", new object[] { builder.GetTransactionID() }); 134 | itemBuilder.Call("setName", new object[] { builder.GetName() }); 135 | itemBuilder.Call("setSku", new object[] { builder.GetSKU() }); 136 | itemBuilder.Call("setCategory", new object[] { builder.GetCategory() }); 137 | itemBuilder.Call("setPrice", new object[] { builder.GetPrice() }); 138 | itemBuilder.Call("setQuantity", new object[] { builder.GetQuantity() }); 139 | itemBuilder.Call("setCurrencyCode", new object[] { builder.GetCurrencyCode() }); 140 | 141 | object[] builtItem = new object[] { itemBuilder.Call("build") }; 142 | tracker.Call("send", builtItem); 143 | } 144 | 145 | public void LogException(ExceptionHitBuilder builder) { 146 | AndroidJavaObject exceptionBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$ExceptionBuilder"); 147 | exceptionBuilder.Call("setDescription", new object[] { builder.GetExceptionDescription() }); 148 | exceptionBuilder.Call("setFatal", new object[] { builder.IsFatal() }); 149 | 150 | object[] builtException = new object[] { exceptionBuilder.Call("build") }; 151 | tracker.Call("send", builtException); 152 | } 153 | 154 | public void LogSocial(SocialHitBuilder builder) { 155 | AndroidJavaObject socialBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$SocialBuilder"); 156 | socialBuilder.Call("setAction", new object[] { builder.GetSocialAction() }); 157 | socialBuilder.Call("setNetwork", new object[] { builder.GetSocialNetwork() }); 158 | socialBuilder.Call("setTarget", new object[] { builder.GetSocialTarget() }); 159 | 160 | object[] builtSocial = new object[] { socialBuilder.Call("build") }; 161 | tracker.Call("send", builtSocial); 162 | } 163 | 164 | public void LogTiming(TimingHitBuilder builder) { 165 | AndroidJavaObject timingBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$TimingBuilder"); 166 | timingBuilder.Call("setCategory", new object[] { builder.GetTimingCategory() }); 167 | timingBuilder.Call("setLabel", new object[] { builder.GetTimingLabel() }); 168 | timingBuilder.Call("setValue", new object[] { builder.GetTimingInterval() }); 169 | timingBuilder.Call("setVariable", new object[] { builder.GetTimingName() }); 170 | 171 | object[] builtTiming = new object[] { timingBuilder.Call("build") }; 172 | tracker.Call("send", builtTiming); 173 | } 174 | 175 | public void DispatchHits() { 176 | } 177 | 178 | public void SetSampleFrequency(int sampleFrequency) { 179 | this.sampleFrequency = sampleFrequency; 180 | } 181 | 182 | public void ClearUserIDOverride() { 183 | SetTrackerVal(Fields.USER_ID, null); 184 | } 185 | 186 | public void SetTrackingCode(string trackingCode) { 187 | this.trackingCode = trackingCode; 188 | } 189 | 190 | public void SetAppName(string appName) { 191 | this.appName = appName; 192 | } 193 | 194 | public void SetBundleIdentifier(string bundleIdentifier) { 195 | this.bundleIdentifier = bundleIdentifier; 196 | } 197 | 198 | public void SetAppVersion(string appVersion) { 199 | this.appVersion = appVersion; 200 | } 201 | 202 | public void SetDispatchPeriod(int dispatchPeriod) { 203 | this.dispatchPeriod = dispatchPeriod; 204 | } 205 | 206 | public void SetLogLevelValue(GoogleAnalyticsV4.DebugMode logLevel) { 207 | //this.logLevel = logLevel; 208 | } 209 | 210 | public void SetAnonymizeIP(bool anonymizeIP) { 211 | this.anonymizeIP = anonymizeIP; 212 | } 213 | 214 | public void SetAdIdCollection(bool adIdCollection) { 215 | this.adIdCollection = adIdCollection; 216 | } 217 | 218 | public void SetDryRun(bool dryRun) { 219 | this.dryRun = dryRun; 220 | } 221 | 222 | #endif 223 | public void Dispose() { 224 | #if UNITY_ANDROID && !UNITY_EDITOR 225 | googleAnalyticsSingleton.Dispose(); 226 | tracker.Dispose(); 227 | #endif 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/GoogleAnalyticsiOSV3.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System; 19 | using System.Collections.Generic; 20 | 21 | /* 22 | GoogleAnalyticsiOSV3 handles building hits using the iOS SDK. 23 | Developers should call the methods in GoogleAnalyticsV4, which will call the 24 | appropriate methods in this class if the application is built for iOS. 25 | */ 26 | public class GoogleAnalyticsiOSV3 { 27 | 28 | #if UNITY_IPHONE && !UNITY_EDITOR 29 | private string trackingCode; 30 | private string appName; 31 | private string bundleIdentifier; 32 | private string appVersion; 33 | private int dispatchPeriod; 34 | private int sampleFrequency; 35 | private GoogleAnalyticsV4.DebugMode logLevel; 36 | private bool anonymizeIP; 37 | private bool adIdCollection; 38 | private bool dryRun; 39 | private GAIHandler handler; 40 | 41 | internal void InitializeTracker () { 42 | Debug.Log ("Initializing Google Analytics iOS Tracker."); 43 | handler = new GAIHandler(); 44 | handler._setDispatchInterval(dispatchPeriod); 45 | handler._setDryRun(dryRun); 46 | handler._setTrackUncaughtExceptions(true); 47 | SetLogLevel(logLevel); 48 | handler._getTrackerWithTrackingId(trackingCode); 49 | 50 | handler._setSampleFrequency(sampleFrequency); 51 | SetTrackerVal(Fields.APP_NAME, appName); 52 | SetTrackerVal(Fields.APP_ID, bundleIdentifier); 53 | SetTrackerVal(Fields.APP_VERSION, appVersion); 54 | 55 | if (adIdCollection) { 56 | handler._enableIDFACollection(); 57 | } 58 | 59 | if(anonymizeIP) { 60 | handler._anonymizeIP(); 61 | } 62 | } 63 | 64 | private void SetLogLevel(GoogleAnalyticsV4.DebugMode logLevel) { 65 | switch(logLevel) 66 | { 67 | case GoogleAnalyticsV4.DebugMode.ERROR: 68 | handler._setLogLevel(1); 69 | break; 70 | case GoogleAnalyticsV4.DebugMode.VERBOSE: 71 | handler._setLogLevel(4); 72 | break; 73 | case GoogleAnalyticsV4.DebugMode.INFO: 74 | handler._setLogLevel(3); 75 | break; 76 | default: 77 | handler._setLogLevel(2); 78 | break; 79 | } 80 | } 81 | 82 | public void ClearUserIDOverride() { 83 | SetTrackerVal(Fields.USER_ID, null); 84 | } 85 | 86 | public void DispatchHits(){ 87 | handler._dispatchHits(); 88 | } 89 | 90 | public void StartSession(){ 91 | handler._startSession(); 92 | } 93 | 94 | public void StopSession(){ 95 | handler._stopSession(); 96 | } 97 | 98 | public void LogScreen(AppViewHitBuilder builder){ 99 | handler._sendAppView(builder); 100 | } 101 | 102 | public void LogEvent(EventHitBuilder builder){ 103 | handler._sendEvent(builder); 104 | } 105 | 106 | internal void LogTransaction(TransactionHitBuilder builder) { 107 | handler._sendTransaction(builder); 108 | } 109 | 110 | internal void LogItem(ItemHitBuilder builder) { 111 | handler._sendItemWithTransaction(builder); 112 | } 113 | 114 | public void LogException(ExceptionHitBuilder builder) { 115 | handler._sendException(builder); 116 | } 117 | 118 | public void LogSocial(SocialHitBuilder builder) { 119 | handler._sendSocial(builder); 120 | } 121 | 122 | public void LogTiming(TimingHitBuilder builder) { 123 | handler._sendTiming(builder); 124 | } 125 | 126 | public void SetOptOut(bool optOut) { 127 | handler._setOptOut(optOut); 128 | } 129 | 130 | public void SetTrackerVal(Field fieldName, object value){ 131 | handler._set(fieldName.ToString(), value); 132 | } 133 | 134 | public void SetTrackingCode(string trackingCode) { 135 | this.trackingCode = trackingCode; 136 | } 137 | 138 | public void SetAppName(string appName) { 139 | this.appName = appName; 140 | } 141 | 142 | public void SetBundleIdentifier(string bundleIdentifier) { 143 | this.bundleIdentifier = bundleIdentifier; 144 | } 145 | 146 | public void SetAppVersion(string appVersion) { 147 | this.appVersion = appVersion; 148 | } 149 | 150 | public void SetDispatchPeriod(int dispatchPeriod) { 151 | this.dispatchPeriod = dispatchPeriod; 152 | } 153 | 154 | public void SetSampleFrequency(int sampleFrequency) { 155 | this.sampleFrequency = sampleFrequency; 156 | } 157 | 158 | public void SetLogLevelValue(GoogleAnalyticsV4.DebugMode logLevel) { 159 | this.logLevel = logLevel; 160 | } 161 | 162 | public void SetAnonymizeIP(bool anonymizeIP) { 163 | this.anonymizeIP = anonymizeIP; 164 | } 165 | 166 | public void SetAdIdCollection(bool adIdCollection) { 167 | this.adIdCollection = adIdCollection; 168 | } 169 | 170 | public void SetDryRun(bool dryRun) { 171 | this.dryRun = dryRun; 172 | } 173 | 174 | #endif 175 | } 176 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/AppViewHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class AppViewHitBuilder : HitBuilder { 23 | 24 | private string screenName = ""; 25 | 26 | public string GetScreenName() { 27 | return screenName; 28 | } 29 | 30 | public AppViewHitBuilder SetScreenName(string screenName) { 31 | if (screenName != null) { 32 | this.screenName = screenName; 33 | } 34 | return this; 35 | } 36 | 37 | public override AppViewHitBuilder GetThis() { 38 | return this; 39 | } 40 | 41 | public override AppViewHitBuilder Validate() { 42 | if (String.IsNullOrEmpty(screenName)) { 43 | Debug.Log("No screen name provided - App View hit cannot be sent."); 44 | return null; 45 | } 46 | return this; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/EventHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class EventHitBuilder : HitBuilder { 23 | 24 | private string eventCategory = ""; 25 | private string eventAction = ""; 26 | private string eventLabel = ""; 27 | private long eventValue; 28 | 29 | public string GetEventCategory() { 30 | return eventCategory; 31 | } 32 | 33 | public EventHitBuilder SetEventCategory(string eventCategory) { 34 | if (eventCategory != null) { 35 | this.eventCategory = eventCategory; 36 | } 37 | return this; 38 | } 39 | 40 | public string GetEventAction() { 41 | return eventAction; 42 | } 43 | 44 | public EventHitBuilder SetEventAction(string eventAction) { 45 | if (eventAction != null) { 46 | this.eventAction = eventAction; 47 | } 48 | return this; 49 | } 50 | 51 | public string GetEventLabel() { 52 | return eventLabel; 53 | } 54 | 55 | public EventHitBuilder SetEventLabel(string eventLabel) { 56 | if (eventLabel != null) { 57 | this.eventLabel = eventLabel; 58 | } 59 | return this; 60 | } 61 | 62 | public long GetEventValue() { 63 | return eventValue; 64 | } 65 | 66 | public EventHitBuilder SetEventValue(long eventValue) { 67 | this.eventValue = eventValue; 68 | return this; 69 | } 70 | 71 | public override EventHitBuilder GetThis() { 72 | return this; 73 | } 74 | 75 | public override EventHitBuilder Validate() { 76 | if (String.IsNullOrEmpty(eventCategory)) { 77 | Debug.LogWarning("No event category provided - Event hit cannot be sent."); 78 | return null; 79 | } 80 | if (String.IsNullOrEmpty(eventAction)) { 81 | Debug.LogWarning("No event action provided - Event hit cannot be sent."); 82 | return null; 83 | } 84 | return this; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/ExceptionHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class ExceptionHitBuilder : HitBuilder { 23 | 24 | private string exceptionDescription = ""; 25 | private bool fatal = false; 26 | 27 | public string GetExceptionDescription(){ 28 | return exceptionDescription; 29 | } 30 | 31 | public ExceptionHitBuilder SetExceptionDescription(string exceptionDescription) { 32 | if(exceptionDescription != null){ 33 | this.exceptionDescription = exceptionDescription; 34 | } 35 | return this; 36 | } 37 | 38 | public bool IsFatal(){ 39 | return fatal; 40 | } 41 | 42 | public ExceptionHitBuilder SetFatal(bool fatal) { 43 | this.fatal = fatal; 44 | return this; 45 | } 46 | 47 | public override ExceptionHitBuilder GetThis(){ 48 | return this; 49 | } 50 | 51 | public override ExceptionHitBuilder Validate(){ 52 | return this; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/HitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | 21 | /* 22 | Base class for building hits. This class stores data which can be sent with 23 | any hit type but cannot be sent independent of other hits. 24 | TODO(emmanuellemm): If we are able to get the referring intent from Unity, 25 | the campaign parameters should be set automatically. 26 | */ 27 | public abstract class HitBuilder { 28 | 29 | private Dictionary customDimensions = 30 | new Dictionary(); 31 | private Dictionary customMetrics = new Dictionary(); 32 | 33 | private string campaignName = ""; 34 | private string campaignSource = ""; 35 | private string campaignMedium = ""; 36 | private string campaignKeyword = ""; 37 | private string campaignContent = ""; 38 | private string campaignID = ""; 39 | private string gclid = ""; 40 | private string dclid = ""; 41 | 42 | public abstract T GetThis(); 43 | public abstract T Validate(); 44 | 45 | public T SetCustomDimension(int dimensionNumber, string value) { 46 | customDimensions.Add(dimensionNumber, value); 47 | return GetThis(); 48 | } 49 | 50 | public Dictionary GetCustomDimensions() { 51 | return customDimensions; 52 | } 53 | 54 | public T SetCustomMetric(int metricNumber, float value) { 55 | customMetrics.Add(metricNumber, value); 56 | return GetThis(); 57 | } 58 | 59 | public Dictionary GetCustomMetrics() { 60 | return customMetrics; 61 | } 62 | 63 | public string GetCampaignName() { 64 | return campaignName; 65 | } 66 | 67 | public T SetCampaignName(string campaignName) { 68 | if (campaignName != null) { 69 | this.campaignName = campaignName; 70 | } 71 | return GetThis(); 72 | } 73 | 74 | public string GetCampaignSource() { 75 | return campaignSource; 76 | } 77 | 78 | public T SetCampaignSource(string campaignSource) { 79 | if (campaignSource != null) { 80 | this.campaignSource = campaignSource; 81 | } else { 82 | Debug.Log("Campaign source cannot be null or empty"); 83 | } 84 | return GetThis(); 85 | } 86 | 87 | public string GetCampaignMedium() { 88 | return campaignMedium; 89 | } 90 | 91 | public T SetCampaignMedium(string campaignMedium) { 92 | if (campaignMedium != null) { 93 | this.campaignMedium = campaignMedium; 94 | } 95 | return GetThis(); 96 | } 97 | 98 | public string GetCampaignKeyword() { 99 | return campaignKeyword; 100 | } 101 | 102 | public T SetCampaignKeyword(string campaignKeyword) { 103 | if (campaignKeyword != null) { 104 | this.campaignKeyword = campaignKeyword; 105 | } 106 | return GetThis(); 107 | } 108 | 109 | public string GetCampaignContent() { 110 | return campaignContent; 111 | } 112 | 113 | public T SetCampaignContent(string campaignContent) { 114 | if (campaignContent != null) { 115 | this.campaignContent = campaignContent; 116 | } 117 | return GetThis(); 118 | } 119 | 120 | public string GetCampaignID() { 121 | return campaignID; 122 | } 123 | 124 | public T SetCampaignID(string campaignID) { 125 | if (campaignID != null) { 126 | this.campaignID = campaignID; 127 | } 128 | return GetThis(); 129 | } 130 | 131 | public string GetGclid() { 132 | return gclid; 133 | } 134 | 135 | public T SetGclid(string gclid) { 136 | if (gclid != null) { 137 | this.gclid = gclid; 138 | } 139 | return GetThis(); 140 | } 141 | 142 | public string GetDclid() { 143 | return dclid; 144 | } 145 | 146 | public T SetDclid(string dclid) { 147 | if (dclid != null) { 148 | this.dclid = dclid; 149 | } 150 | return GetThis(); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/ItemHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class ItemHitBuilder : HitBuilder { 23 | 24 | private string transactionID = ""; 25 | private string name = ""; 26 | private string SKU = ""; 27 | private double price; 28 | private string category = ""; 29 | private long quantity; 30 | private string currencyCode = ""; 31 | 32 | public string GetTransactionID() { 33 | return transactionID; 34 | } 35 | 36 | public ItemHitBuilder SetTransactionID(string transactionID) { 37 | if(transactionID != null){ 38 | this.transactionID = transactionID; 39 | } 40 | return this; 41 | } 42 | 43 | public string GetName() { 44 | return name; 45 | } 46 | 47 | public ItemHitBuilder SetName(string name) { 48 | if(name != null){ 49 | this.name = name; 50 | } 51 | return this; 52 | } 53 | 54 | public string GetSKU() { 55 | return SKU; 56 | } 57 | 58 | public ItemHitBuilder SetSKU(string SKU) { 59 | if(SKU != null){ 60 | this.SKU = SKU; 61 | } 62 | return this; 63 | } 64 | 65 | public double GetPrice() { 66 | return price; 67 | } 68 | 69 | public ItemHitBuilder SetPrice(double price) { 70 | this.price = price; 71 | return this; 72 | } 73 | 74 | public string GetCategory() { 75 | return category; 76 | } 77 | 78 | public ItemHitBuilder SetCategory(string category) { 79 | if(category != null){ 80 | this.category = category; 81 | } 82 | return this; 83 | } 84 | 85 | public long GetQuantity() { 86 | return quantity; 87 | } 88 | 89 | public ItemHitBuilder SetQuantity(long quantity) { 90 | this.quantity = quantity; 91 | return this; 92 | } 93 | 94 | public string GetCurrencyCode() { 95 | return currencyCode; 96 | } 97 | 98 | public ItemHitBuilder SetCurrencyCode(string currencyCode) { 99 | if(currencyCode != null){ 100 | this.currencyCode = currencyCode; 101 | } 102 | return this; 103 | } 104 | 105 | public override ItemHitBuilder GetThis(){ 106 | return this; 107 | } 108 | 109 | public override ItemHitBuilder Validate(){ 110 | if(String.IsNullOrEmpty(transactionID)){ 111 | Debug.LogWarning("No transaction ID provided - Item hit cannot be sent."); 112 | return null; 113 | } 114 | if(String.IsNullOrEmpty(name)){ 115 | Debug.LogWarning("No name provided - Item hit cannot be sent."); 116 | return null; 117 | } 118 | if(String.IsNullOrEmpty(SKU)){ 119 | Debug.LogWarning("No SKU provided - Item hit cannot be sent."); 120 | return null; 121 | } 122 | if(price == 0.0D){ 123 | Debug.Log("Price in item hit is 0."); 124 | } 125 | if(quantity == 0L){ 126 | Debug.Log("Quantity in item hit is 0."); 127 | } 128 | return this; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/SocialHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class SocialHitBuilder : HitBuilder { 23 | 24 | private string socialNetwork = ""; 25 | private string socialAction = ""; 26 | private string socialTarget = ""; 27 | 28 | public string GetSocialNetwork(){ 29 | return socialNetwork; 30 | } 31 | 32 | public SocialHitBuilder SetSocialNetwork(string socialNetwork) { 33 | if(socialNetwork != null){ 34 | this.socialNetwork = socialNetwork; 35 | } 36 | return this; 37 | } 38 | 39 | public string GetSocialAction(){ 40 | return socialAction; 41 | } 42 | 43 | public SocialHitBuilder SetSocialAction(string socialAction) { 44 | if(socialAction != null){ 45 | this.socialAction = socialAction; 46 | } 47 | return this; 48 | } 49 | 50 | public string GetSocialTarget(){ 51 | return socialTarget; 52 | } 53 | 54 | public SocialHitBuilder SetSocialTarget(string socialTarget) { 55 | if(socialTarget != null){ 56 | this.socialTarget = socialTarget; 57 | } 58 | return this; 59 | } 60 | 61 | public override SocialHitBuilder GetThis(){ 62 | return this; 63 | } 64 | 65 | public override SocialHitBuilder Validate(){ 66 | if(String.IsNullOrEmpty(socialNetwork)){ 67 | Debug.LogError("No social network provided - Social hit cannot be sent"); 68 | return null; 69 | } 70 | if(String.IsNullOrEmpty(socialAction)){ 71 | Debug.LogError("No social action provided - Social hit cannot be sent"); 72 | return null; 73 | } 74 | if(String.IsNullOrEmpty(socialTarget)){ 75 | Debug.LogError("No social target provided - Social hit cannot be sent"); 76 | return null; 77 | } 78 | return this; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/TimingHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections.Generic; 19 | using System; 20 | 21 | public class TimingHitBuilder : HitBuilder { 22 | 23 | private string timingCategory = ""; 24 | private long timingInterval; 25 | private string timingName = ""; 26 | private string timingLabel = ""; 27 | 28 | public string GetTimingCategory(){ 29 | return timingCategory; 30 | } 31 | 32 | public TimingHitBuilder SetTimingCategory(string timingCategory) { 33 | if(timingCategory != null){ 34 | this.timingCategory = timingCategory; 35 | } 36 | return this; 37 | } 38 | 39 | public long GetTimingInterval(){ 40 | return timingInterval; 41 | } 42 | 43 | public TimingHitBuilder SetTimingInterval(long timingInterval) { 44 | this.timingInterval = timingInterval; 45 | return this; 46 | } 47 | 48 | public string GetTimingName(){ 49 | return timingName; 50 | } 51 | 52 | public TimingHitBuilder SetTimingName(string timingName) { 53 | if(timingName != null){ 54 | this.timingName = timingName; 55 | } 56 | return this; 57 | } 58 | 59 | public string GetTimingLabel(){ 60 | return timingLabel; 61 | } 62 | 63 | public TimingHitBuilder SetTimingLabel(string timingLabel) { 64 | if(timingLabel != null){ 65 | this.timingLabel = timingLabel; 66 | } 67 | return this; 68 | } 69 | 70 | public override TimingHitBuilder GetThis(){ 71 | return this; 72 | } 73 | 74 | public override TimingHitBuilder Validate(){ 75 | if(String.IsNullOrEmpty(timingCategory)){ 76 | Debug.LogError("No timing category provided - Timing hit cannot be sent"); 77 | return null; 78 | } 79 | if(timingInterval == 0L){ 80 | Debug.Log("Interval in timing hit is 0."); 81 | } 82 | return this; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/HitBuilders/TransactionHitBuilder.cs: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 Google Inc. All rights reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | using UnityEngine; 18 | using System.Collections; 19 | using System.Collections.Generic; 20 | using System; 21 | 22 | public class TransactionHitBuilder : HitBuilder { 23 | 24 | private string transactionID = ""; 25 | private string affiliation = ""; 26 | private double revenue; 27 | private double tax; 28 | private double shipping; 29 | private string currencyCode = ""; 30 | 31 | public string GetTransactionID() { 32 | return transactionID; 33 | } 34 | 35 | public TransactionHitBuilder SetTransactionID(string transactionID) { 36 | if(transactionID != null){ 37 | this.transactionID = transactionID; 38 | } 39 | return this; 40 | } 41 | 42 | public string GetAffiliation() { 43 | return affiliation; 44 | } 45 | 46 | public TransactionHitBuilder SetAffiliation(string affiliation) { 47 | if(affiliation != null){ 48 | this.affiliation = affiliation; 49 | } 50 | return this; 51 | } 52 | 53 | public double GetRevenue() { 54 | return revenue; 55 | } 56 | 57 | public TransactionHitBuilder SetRevenue(double revenue) { 58 | this.revenue = revenue; 59 | return this; 60 | } 61 | 62 | public double GetTax() { 63 | return tax; 64 | } 65 | 66 | public TransactionHitBuilder SetTax(double tax) { 67 | this.tax = tax; 68 | return this; 69 | } 70 | 71 | public double GetShipping() { 72 | return shipping; 73 | } 74 | 75 | public TransactionHitBuilder SetShipping(double shipping) { 76 | this.shipping = shipping; 77 | return this; 78 | } 79 | 80 | public string GetCurrencyCode() { 81 | return currencyCode; 82 | } 83 | 84 | public TransactionHitBuilder SetCurrencyCode(string currencyCode) { 85 | if(currencyCode != null){ 86 | this.currencyCode = currencyCode; 87 | } 88 | return this; 89 | } 90 | 91 | public override TransactionHitBuilder GetThis(){ 92 | return this; 93 | } 94 | 95 | public override TransactionHitBuilder Validate(){ 96 | if(String.IsNullOrEmpty(transactionID)){ 97 | Debug.LogWarning("No transaction ID provided - Transaction hit cannot be sent."); 98 | return null; 99 | } 100 | if(String.IsNullOrEmpty(affiliation)){ 101 | Debug.LogWarning("No affiliation provided - Transaction hit cannot be sent."); 102 | return null; 103 | } 104 | if(revenue == 0){ 105 | Debug.Log("Revenue in transaction hit is 0."); 106 | } 107 | if(tax == 0){ 108 | Debug.Log("Tax in transaction hit is 0."); 109 | } 110 | if(shipping == 0){ 111 | Debug.Log("Shipping in transaction hit is 0."); 112 | } 113 | return this; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /source/Plugins/GoogleAnalyticsV4/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAI.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAI.h 3 | @abstract Google Analytics iOS SDK Header 4 | @version 3.15 5 | @copyright Copyright 2015 Google Inc. All rights reserved. 6 | */ 7 | 8 | #import 9 | 10 | #import "GAILogger.h" 11 | #import "GAITrackedViewController.h" 12 | #import "GAITracker.h" 13 | 14 | typedef NS_ENUM(NSUInteger, GAIDispatchResult) { 15 | kGAIDispatchNoData, 16 | kGAIDispatchGood, 17 | kGAIDispatchError 18 | }; 19 | 20 | /*! Google Analytics product string. */ 21 | extern NSString *const kGAIProduct; 22 | 23 | /*! Google Analytics version string. */ 24 | extern NSString *const kGAIVersion; 25 | 26 | /*! 27 | NSError objects returned by the Google Analytics SDK may have this error domain 28 | to indicate that the error originated in the Google Analytics SDK. 29 | */ 30 | extern NSString *const kGAIErrorDomain; 31 | 32 | /*! Google Analytics error codes. */ 33 | typedef enum { 34 | // This error code indicates that there was no error. Never used. 35 | kGAINoError = 0, 36 | 37 | // This error code indicates that there was a database-related error. 38 | kGAIDatabaseError, 39 | 40 | // This error code indicates that there was a network-related error. 41 | kGAINetworkError, 42 | } GAIErrorCode; 43 | 44 | /*! 45 | Google Analytics iOS top-level class. Provides facilities to create trackers 46 | and set behaviorial flags. 47 | */ 48 | @interface GAI : NSObject 49 | 50 | /*! 51 | For convenience, this class exposes a default tracker instance. 52 | This is initialized to `nil` and will be set to the first tracker that is 53 | instantiated in trackerWithTrackingId:. It may be overridden as desired. 54 | 55 | The GAITrackedViewController class will, by default, use this tracker instance. 56 | */ 57 | @property(nonatomic, assign) id defaultTracker; 58 | 59 | /*! 60 | The GAILogger to use. 61 | */ 62 | @property(nonatomic, retain) id logger; 63 | 64 | /*! 65 | When this is true, no tracking information will be gathered; tracking calls 66 | will effectively become no-ops. When set to true, all tracking information that 67 | has not yet been submitted. The value of this flag will be persisted 68 | automatically by the SDK. Developers can optionally use this flag to implement 69 | an opt-out setting in the app to allows users to opt out of Google Analytics 70 | tracking. 71 | 72 | This is set to `NO` the first time the Google Analytics SDK is used on a 73 | device, and is persisted thereafter. 74 | */ 75 | @property(nonatomic, assign) BOOL optOut; 76 | 77 | /*! 78 | If this value is positive, tracking information will be automatically 79 | dispatched every dispatchInterval seconds. Otherwise, tracking information must 80 | be sent manually by calling dispatch. 81 | 82 | By default, this is set to `120`, which indicates tracking information should 83 | be dispatched automatically every 120 seconds. 84 | */ 85 | @property(nonatomic, assign) NSTimeInterval dispatchInterval; 86 | 87 | /*! 88 | When set to true, the SDK will record the currently registered uncaught 89 | exception handler, and then register an uncaught exception handler which tracks 90 | the exceptions that occurred using defaultTracker. If defaultTracker is not 91 | `nil`, this function will track the exception on the tracker and attempt to 92 | dispatch any outstanding tracking information for 5 seconds. It will then call 93 | the previously registered exception handler, if any. When set back to false, 94 | the previously registered uncaught exception handler will be restored. 95 | */ 96 | @property(nonatomic, assign) BOOL trackUncaughtExceptions; 97 | 98 | /*! 99 | When this is 'YES', no tracking information will be sent. Defaults to 'NO'. 100 | */ 101 | @property(nonatomic, assign) BOOL dryRun; 102 | 103 | /*! Get the shared instance of the Google Analytics for iOS class. */ 104 | + (GAI *)sharedInstance; 105 | 106 | /*! 107 | Creates or retrieves a GAITracker implementation with the specified name and 108 | tracking ID. If the tracker for the specified name does not already exist, then 109 | it will be created and returned; otherwise, the existing tracker will be 110 | returned. If the existing tracker for the respective name has a different 111 | tracking ID, that tracking ID is not changed by this method. If defaultTracker 112 | is not set, it will be set to the tracker instance returned here. 113 | 114 | @param name The name of this tracker. Must not be `nil` or empty. 115 | 116 | @param trackingID The tracking ID to use for this tracker. It should be of 117 | the form `UA-xxxxx-y`. 118 | 119 | @return A GAITracker associated with the specified name. The tracker 120 | can be used to send tracking data to Google Analytics. The first time this 121 | method is called with a particular name, the tracker for that name will be 122 | returned, and subsequent calls with the same name will return the same 123 | instance. It is not necessary to retain the tracker because the tracker will be 124 | retained internally by the library. 125 | 126 | If an error occurs or the name is not valid, this method will return 127 | `nil`. 128 | */ 129 | - (id)trackerWithName:(NSString *)name 130 | trackingId:(NSString *)trackingId; 131 | 132 | /*! 133 | Creates or retrieves a GAITracker implementation with name equal to 134 | the specified tracking ID. If the tracker for the respective name does not 135 | already exist, it is created, has it's tracking ID set to |trackingId|, 136 | and is returned; otherwise, the existing tracker is returned. If the existing 137 | tracker for the respective name has a different tracking ID, that tracking ID 138 | is not changed by this method. If defaultTracker is not set, it is set to the 139 | tracker instance returned here. 140 | 141 | @param trackingID The tracking ID to use for this tracker. It should be of 142 | the form `UA-xxxxx-y`. The name of the tracker will be the same as trackingID. 143 | 144 | @return A GAITracker associated with the specified trackingID. The tracker 145 | can be used to send tracking data to Google Analytics. The first time this 146 | method is called with a particular trackingID, the tracker for the respective 147 | name will be returned, and subsequent calls with the same trackingID 148 | will return the same instance. It is not necessary to retain the tracker 149 | because the tracker will be retained internally by the library. 150 | 151 | If an error occurs or the trackingId is not valid, this method will return 152 | `nil`. 153 | */ 154 | - (id)trackerWithTrackingId:(NSString *)trackingId; 155 | 156 | /*! 157 | Remove a tracker from the trackers dictionary. If it is the default tracker, 158 | clears the default tracker as well. 159 | 160 | @param name The name of the tracker. 161 | */ 162 | - (void)removeTrackerByName:(NSString *)name; 163 | 164 | /*! 165 | Dispatches any pending tracking information. 166 | 167 | Note that this does not have any effect on dispatchInterval, and can be used in 168 | conjunction with periodic dispatch. */ 169 | - (void)dispatch; 170 | 171 | /*! 172 | Dispatches the next tracking beacon in the queue, calling completionHandler when 173 | the tracking beacon has either been sent (returning kGAIDispatchGood) or an error has resulted 174 | (returning kGAIDispatchError). If there is no network connection or there is no data to send, 175 | kGAIDispatchNoData is returned. 176 | 177 | Note that calling this method with a non-nil completionHandler disables periodic dispatch. 178 | Periodic dispatch can be reenabled by setting the dispatchInterval to a positive number when 179 | the app resumes from the background. 180 | 181 | Calling this method with a nil completionHandler is the same as calling the dispatch 182 | above. 183 | 184 | This method can be used for background data fetching in iOS 7.0 or later. It would be wise to 185 | call this when the application is exiting to initiate the submission of any unsubmitted 186 | tracking information. 187 | 188 | @param completionHandler The block to run after a single dispatch request. The GAIDispatchResult 189 | param indicates whether the dispatch succeeded, had an error, or had no hits to dispatch. 190 | */ 191 | - (void)dispatchWithCompletionHandler:(void (^)(GAIDispatchResult result))completionHandler; 192 | @end 193 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIDictionaryBuilder.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIDictionaryBuilder.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | #import "GAIEcommerceProduct.h" 10 | #import "GAIEcommerceProductAction.h" 11 | #import "GAIEcommercePromotion.h" 12 | 13 | /*! 14 | * Helper class to build a dictionary of hit parameters and values. 15 | *
16 | * Examples: 17 | * 18 | * id t = // get a tracker. 19 | * [t send:[[[GAIDictionaryBuilder createEventWithCategory:@"EventCategory" 20 | * action:@"EventAction" 21 | * label:nil 22 | * value:nil] 23 | * set:@"dimension1" forKey:[GAIFields customDimensionForIndex:1]] build]]; 24 | * 25 | * This will send an event hit type with the specified parameters 26 | * and a custom dimension parameter. 27 | *
28 | * If you want to send a parameter with all hits, set it on GAITracker directly. 29 | * 30 | * [t set:kGAIScreenName value:@"Home"]; 31 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 32 | * action:@"PlusOne" 33 | * target:@"SOME_URL"] build]]; 34 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 35 | * action:@"Share" 36 | * target:@"SOME_POST"] build]]; 37 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 38 | * action:@"HangOut" 39 | * target:@"SOME_CIRCLE"] 40 | * build]]; 41 | * 42 | * You can override a value set on the tracker by adding it to the dictionary. 43 | * 44 | * [t set:kGAIScreenName value:@"Home"]; 45 | * [t send:...]; 46 | * [t send[[[GAIDictionaryBuilder createEventWithCategory:@"click" 47 | * action:@"popup" 48 | * label:nil 49 | * value:nil] 50 | * set:@"popup title" forKey:kGAIScreenName] build]]; 51 | * 52 | * The values set via [GAIDictionaryBuilder set] or 53 | * [GAIDictionaryBuilder setAll] will override any existing values in the 54 | * GAIDictionaryBuilder object (i.e. initialized by 55 | * [GAIDictionaryBuilder createXYZ]). e.g. 56 | * 57 | * GAIDictionaryBuilder *m = 58 | * GAIDictionaryBuilder createTimingWithCategory:@"category" 59 | * interval:@0 60 | * name:@"name" 61 | * label:nil]; 62 | * [t send:[m.set:@"10" forKey:kGAITimingVar] build]; 63 | * [t send:[m.set:@"20" forKey:kGAITimingVar] build]; 64 | * 65 | */ 66 | @interface GAIDictionaryBuilder : NSObject 67 | 68 | - (GAIDictionaryBuilder *)set:(NSString *)value 69 | forKey:(NSString *)key; 70 | 71 | /*! 72 | * Copies all the name-value pairs from params into this object, ignoring any 73 | * keys that are not NSString and any values that are neither NSString or 74 | * NSNull. 75 | */ 76 | - (GAIDictionaryBuilder *)setAll:(NSDictionary *)params; 77 | 78 | /*! 79 | * Returns the value for the input parameter paramName, or nil if paramName 80 | * is not present. 81 | */ 82 | - (NSString *)get:(NSString *)paramName; 83 | 84 | /*! 85 | * Return an NSMutableDictionary object with all the parameters set in this 86 | */ 87 | - (NSMutableDictionary *)build; 88 | 89 | /*! 90 | * Parses and translates utm campaign parameters to analytics campaign param 91 | * and returns them as a map. 92 | * 93 | * @param params url containing utm campaign parameters. 94 | * 95 | * Valid campaign parameters are: 96 | *
    97 | *
  • utm_id
  • 98 | *
  • utm_campaign
  • 99 | *
  • utm_content
  • 100 | *
  • utm_medium
  • 101 | *
  • utm_source
  • 102 | *
  • utm_term
  • 103 | *
  • dclid
  • 104 | *
  • gclid
  • 105 | *
  • gmob_t
  • 106 | *
  • aclid
  • 107 | *
  • anid
  • 108 | *
109 | *

110 | * Example: 111 | * http://my.site.com/index.html?utm_campaign=wow&utm_source=source 112 | * utm_campaign=wow&utm_source=source. 113 | *

114 | * For more information on auto-tagging, see 115 | * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55590 116 | *

117 | * For more information on manual tagging, see 118 | * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55518 119 | */ 120 | - (GAIDictionaryBuilder *)setCampaignParametersFromUrl:(NSString *)urlString; 121 | 122 | /*! 123 | Returns a GAIDictionaryBuilder object with parameters specific to an appview 124 | hit. 125 | 126 | Note that using this method will not set the screen name for followon hits. To 127 | do that you need to call set:kGAIDescription value: on the 128 | GAITracker instance. 129 | 130 | This method is deprecated. Use createScreenView instead. 131 | */ 132 | + (GAIDictionaryBuilder *)createAppView DEPRECATED_MSG_ATTRIBUTE("Use createScreenView instead."); 133 | 134 | /*! 135 | Returns a GAIDictionaryBuilder object with parameters specific to a screenview 136 | hit. 137 | 138 | Note that using this method will not set the screen name for followon hits. To 139 | do that you need to call set:kGAIDescription value: on the 140 | GAITracker instance. 141 | */ 142 | + (GAIDictionaryBuilder *)createScreenView; 143 | 144 | /*! 145 | Returns a GAIDictionaryBuilder object with parameters specific to an event hit. 146 | */ 147 | + (GAIDictionaryBuilder *)createEventWithCategory:(NSString *)category 148 | action:(NSString *)action 149 | label:(NSString *)label 150 | value:(NSNumber *)value; 151 | 152 | /*! 153 | Returns a GAIDictionaryBuilder object with parameters specific to an exception 154 | hit. 155 | */ 156 | + (GAIDictionaryBuilder *)createExceptionWithDescription:(NSString *)description 157 | withFatal:(NSNumber *)fatal; 158 | 159 | /*! 160 | Returns a GAIDictionaryBuilder object with parameters specific to an item hit. 161 | */ 162 | + (GAIDictionaryBuilder *)createItemWithTransactionId:(NSString *)transactionId 163 | name:(NSString *)name 164 | sku:(NSString *)sku 165 | category:(NSString *)category 166 | price:(NSNumber *)price 167 | quantity:(NSNumber *)quantity 168 | currencyCode:(NSString *)currencyCode; 169 | 170 | /*! 171 | Returns a GAIDictionaryBuilder object with parameters specific to a social hit. 172 | */ 173 | + (GAIDictionaryBuilder *)createSocialWithNetwork:(NSString *)network 174 | action:(NSString *)action 175 | target:(NSString *)target; 176 | 177 | /*! 178 | Returns a GAIDictionaryBuilder object with parameters specific to a timing hit. 179 | */ 180 | + (GAIDictionaryBuilder *)createTimingWithCategory:(NSString *)category 181 | interval:(NSNumber *)intervalMillis 182 | name:(NSString *)name 183 | label:(NSString *)label; 184 | 185 | /*! 186 | Returns a GAIDictionaryBuilder object with parameters specific to a transaction 187 | hit. 188 | */ 189 | + (GAIDictionaryBuilder *)createTransactionWithId:(NSString *)transactionId 190 | affiliation:(NSString *)affiliation 191 | revenue:(NSNumber *)revenue 192 | tax:(NSNumber *)tax 193 | shipping:(NSNumber *)shipping 194 | currencyCode:(NSString *)currencyCode; 195 | 196 | /*! 197 | Set the product action field for this hit. 198 | */ 199 | - (GAIDictionaryBuilder *)setProductAction:(GAIEcommerceProductAction *)productAction; 200 | 201 | /*! 202 | Adds a product to this hit. 203 | */ 204 | - (GAIDictionaryBuilder *)addProduct:(GAIEcommerceProduct *)product; 205 | 206 | /*! 207 | Add a product impression to this hit. 208 | */ 209 | - (GAIDictionaryBuilder *)addProductImpression:(GAIEcommerceProduct *)product 210 | impressionList:(NSString *)name 211 | impressionSource:(NSString *)source; 212 | 213 | /*! 214 | Add a promotion to this hit. 215 | */ 216 | - (GAIDictionaryBuilder *)addPromotion:(GAIEcommercePromotion *)promotion; 217 | @end 218 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIEcommerceFields.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommerceFields.h 3 | @abstract Google Analytics iOS SDK Ecommerce Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | This class provides several fields and methods useful as wire format parameters for 11 | Enhanced Ecommerce. See the online developer guides for Enhanced Ecommerce for details 12 | on how to use the Enhanced Ecommerce features. 13 | */ 14 | 15 | // Enhanced Ecommerce Product fields 16 | extern NSString *const kGAIProductId; 17 | extern NSString *const kGAIProductName; 18 | extern NSString *const kGAIProductBrand; 19 | extern NSString *const kGAIProductCategory; 20 | extern NSString *const kGAIProductVariant; 21 | extern NSString *const kGAIProductPrice; 22 | extern NSString *const kGAIProductQuantity; 23 | extern NSString *const kGAIProductCouponCode; 24 | extern NSString *const kGAIProductPosition; 25 | 26 | extern NSString *const kGAIProductAction; 27 | 28 | // product action values 29 | extern NSString *const kGAIPADetail; 30 | extern NSString *const kGAIPAClick; 31 | extern NSString *const kGAIPAAdd; 32 | extern NSString *const kGAIPARemove; 33 | extern NSString *const kGAIPACheckout; 34 | extern NSString *const kGAIPACheckoutOption; 35 | extern NSString *const kGAIPAPurchase; 36 | extern NSString *const kGAIPARefund; 37 | 38 | // product action fields 39 | // used for 'purchase' and 'refund' actions 40 | extern NSString *const kGAIPATransactionId; 41 | extern NSString *const kGAIPAAffiliation; 42 | extern NSString *const kGAIPARevenue; 43 | extern NSString *const kGAIPATax; 44 | extern NSString *const kGAIPAShipping; 45 | extern NSString *const kGAIPACouponCode; 46 | // used for 'checkout' action 47 | extern NSString *const kGAICheckoutStep; 48 | extern NSString *const kGAICheckoutOption; 49 | // used for 'detail' and 'click' actions 50 | extern NSString *const kGAIProductActionList; 51 | extern NSString *const kGAIProductListSource; 52 | 53 | // Enhanced Ecommerce Impressions fields 54 | extern NSString *const kGAIImpressionName; 55 | extern NSString *const kGAIImpressionListSource; 56 | extern NSString *const kGAIImpressionProduct; 57 | extern NSString *const kGAIImpressionProductId; 58 | extern NSString *const kGAIImpressionProductName; 59 | extern NSString *const kGAIImpressionProductBrand; 60 | extern NSString *const kGAIImpressionProductCategory; 61 | extern NSString *const kGAIImpressionProductVariant; 62 | extern NSString *const kGAIImpressionProductPosition; 63 | extern NSString *const kGAIImpressionProductPrice; 64 | 65 | // Enhanced Ecommerce Promotions fields 66 | extern NSString *const kGAIPromotionId; 67 | extern NSString *const kGAIPromotionName; 68 | extern NSString *const kGAIPromotionCreative; 69 | extern NSString *const kGAIPromotionPosition; 70 | 71 | // Promotion actions 72 | extern NSString *const kGAIPromotionAction; 73 | extern NSString *const kGAIPromotionView; 74 | extern NSString *const kGAIPromotionClick; 75 | 76 | @interface GAIEcommerceFields : NSObject 77 | 78 | /*! 79 | Generates an enhanced ecommerce product field. Note that field names generated by 80 | customDimensionForIndex and customMetricForIndex can be used as suffixes. 81 | 82 | @param index the index of the product 83 | @param suffix the product field suffix (such as kGAIProductPrice). 84 | 85 | @return an NSString representing the product field parameter 86 | */ 87 | + (NSString *)productFieldForIndex:(NSUInteger)index suffix:(NSString *)suffix; 88 | 89 | /*! 90 | Genrates an enhanced ecommerce impression list field name with an index. The return value of 91 | this method should also be used as input to the productImpressionForList method below. 92 | 93 | @param index the index of the impression list 94 | 95 | @return an NSString representing the impression list parameter 96 | */ 97 | + (NSString *)impressionListForIndex:(NSUInteger)index; 98 | 99 | /*! 100 | Generates an enhanced ecommerce product impression field with the impression list, product index 101 | and product suffix as parameters. The output of the method impressionListForIndex above should be 102 | used as the input list for this method. The output of customDimensionForIndex and 103 | customMetricForIndex can be used as suffixes. 104 | 105 | @param list the impression list for this product impression 106 | @param index the index of this product in the impression list 107 | @param suffix the product impression suffix for this field 108 | 109 | @return an NSString representing this product impression field parameter 110 | */ 111 | + (NSString *)productImpressionForList:(NSString *)list 112 | index:(NSUInteger)index 113 | suffix:(NSString *)Suffix; 114 | 115 | /*! 116 | Generates an enhanced ecommerce promotion field with an index and suffix. 117 | 118 | @param index the index of the promotion 119 | @param suffix the promotion suffix (such as kGAIPromotionId) 120 | 121 | @return an NSString representing this promotion field paramter 122 | */ 123 | + (NSString *)promotionForIndex:(NSUInteger)index suffix:(NSString *)suffix; 124 | @end 125 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIEcommerceProduct.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommerceProduct.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct product related information for a Google Analytics beacon. Use this class to 11 | * report information about products sold by merchants or impressions of products seen by users. 12 | * Instances of this class can be associated with both Product Actions and Product 13 | * Impression Lists. 14 | *
15 | * Typical usage: 16 | * 17 | * [tracker set:kGAIScreenName value:@"MyScreen"]; 18 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 19 | * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; 20 | * [product setId:@""PID-1234""]; 21 | * [product setName:@"Space Monkeys!"]; 22 | * [product setPrice:@100]; 23 | * [product setQuantity:@2]; 24 | * [builder addProductImpression:product impressionList:@"listName"]; 25 | * [tracker send:[builder build]]; 26 | * 27 | */ 28 | @interface GAIEcommerceProduct : NSObject 29 | 30 | /*! 31 | Sets the id that is used to identify a product in GA reports. 32 | */ 33 | - (GAIEcommerceProduct *)setId:(NSString *)productId; 34 | 35 | /*! 36 | Sets the name that is used to indentify the product in GA reports. 37 | */ 38 | - (GAIEcommerceProduct *)setName:(NSString *)productName; 39 | 40 | /*! 41 | Sets the brand associated with the product in GA reports. 42 | */ 43 | - (GAIEcommerceProduct *)setBrand:(NSString *)productBrand; 44 | 45 | /*! 46 | Sets the category associated with the product in GA reports. 47 | */ 48 | - (GAIEcommerceProduct *)setCategory:(NSString *)productCategory; 49 | 50 | /*! 51 | Sets the variant of the product. 52 | */ 53 | - (GAIEcommerceProduct *)setVariant:(NSString *)productVariant; 54 | 55 | /*! 56 | Sets the price of the product. 57 | */ 58 | - (GAIEcommerceProduct *)setPrice:(NSNumber *)productPrice; 59 | 60 | /*! 61 | Sets the quantity of the product. This field is usually not used with product impressions. 62 | */ 63 | - (GAIEcommerceProduct *)setQuantity:(NSNumber *)productQuantity; 64 | 65 | /*! 66 | Sets the coupon code associated with the product. This field is usually not used with product 67 | impressions. 68 | */ 69 | - (GAIEcommerceProduct *)setCouponCode:(NSString *)productCouponCode; 70 | 71 | /*! 72 | Sets the position of the product on the screen/product impression list, etc. 73 | */ 74 | - (GAIEcommerceProduct *)setPosition:(NSNumber *)productPosition; 75 | 76 | /*! 77 | Sets the custom dimension associated with this product. 78 | */ 79 | - (GAIEcommerceProduct *)setCustomDimension:(NSUInteger)index value:(NSString *)value; 80 | 81 | /*! 82 | Sets the custom metric associated with this product. 83 | */ 84 | - (GAIEcommerceProduct *)setCustomMetric:(NSUInteger)index value:(NSNumber *)value; 85 | 86 | /*! 87 | Builds an NSDictionary of fields stored in this instance suitable for a product action. The 88 | index parameter is the index of this product in the product action list. 89 |
90 | Normally, users will have no need to call this method. 91 | */ 92 | - (NSDictionary *)buildWithIndex:(NSUInteger)index; 93 | 94 | /*! 95 | Builds an NSDictionary of fields stored in this instance suitable for an impression list. The 96 | lIndex parameter is the index of the product impression list while the index parameter is the 97 | index of this product in that impression list. 98 |
99 | Normally, users will have no need to call this method. 100 | */ 101 | - (NSDictionary *)buildWithListIndex:(NSUInteger)lIndex index:(NSUInteger)index; 102 | @end 103 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIEcommerceProductAction.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIProductAction.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct transaction/checkout or other product interaction related information for a 11 | * Google Analytics hit. Use this class to report information about products sold, viewed or 12 | * refunded. This class is intended to be used with GAIDictionaryBuilder. 13 | *
14 | * Typical usage: 15 | * 16 | * [tracker set:kGAIScreenName value:@"MyScreen"]; 17 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 18 | * GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init]; 19 | * [action setAction:kGAIPAPurchase]; 20 | * [action setTransactionId:@"TT-1234"]; 21 | * [action setRevenue:@3.14]; 22 | * [action setCouponCode:@"EXTRA100"]; 23 | * [builder setProductAction:action]; 24 | * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; 25 | * [product setId:@""PID-1234""]; 26 | * [product setName:@"Space Monkeys!"]; 27 | * [product setPrice:@100]; 28 | * [product setQuantity:@2]; 29 | * [builder addProduct:product]; 30 | * [tracker send:[builder build]]; 31 | * 32 | */ 33 | @interface GAIEcommerceProductAction : NSObject 34 | 35 | /*! 36 | Sets the product action field for this product action. Valid values can be found in 37 | GAIEcommerceFields.h under "product action values". 38 | */ 39 | - (GAIEcommerceProductAction *)setAction:(NSString *)productAction; 40 | 41 | /*! 42 | The unique id associated with the transaction. This value is used for kGAIPAPurchase and 43 | kGAIPARefund product actions. 44 | */ 45 | - (GAIEcommerceProductAction *)setTransactionId:(NSString *)transactionId; 46 | 47 | /*! 48 | Sets the transaction's affiliation value. This value is used for kGAIPAPurchase and 49 | kGAIPARefund product actions. 50 | */ 51 | - (GAIEcommerceProductAction *)setAffiliation:(NSString *)affiliation; 52 | 53 | /*! 54 | Sets the transaction's total revenue. This value is used for kGAIPAPurchase and kGAIPARefund 55 | product actions. 56 | */ 57 | - (GAIEcommerceProductAction *)setRevenue:(NSNumber *)revenue; 58 | 59 | /*! 60 | Sets the transaction's total tax. This value is used for kGAIPAPurchase and kGAIPARefund 61 | product actions. 62 | */ 63 | - (GAIEcommerceProductAction *)setTax:(NSNumber *)tax; 64 | 65 | /*! 66 | Sets the transaction's total shipping costs. This value is used for kGAIPAPurchase and 67 | kGAIPARefund product actions. 68 | */ 69 | - (GAIEcommerceProductAction *)setShipping:(NSNumber *)shipping; 70 | 71 | /*! 72 | Sets the coupon code used in this transaction. This value is used for kGAIPAPurchase and 73 | kGAIPARefund product actions. 74 | */ 75 | - (GAIEcommerceProductAction *)setCouponCode:(NSString *)couponCode; 76 | 77 | /*! 78 | Sets the checkout process's progress. This value is used for kGAICheckout and 79 | kGAICheckoutOptions product actions. 80 | */ 81 | - (GAIEcommerceProductAction *)setCheckoutStep:(NSNumber *)checkoutStep; 82 | 83 | /*! 84 | Sets the option associated with the checkout. This value is used for kGAICheckout and 85 | kGAICheckoutOptions product actions. 86 | */ 87 | - (GAIEcommerceProductAction *)setCheckoutOption:(NSString *)checkoutOption; 88 | 89 | /*! 90 | Sets the list name associated with the products in Google Analytics beacons. This value is 91 | used in kGAIPADetail and kGAIPAClick product actions. 92 | */ 93 | - (GAIEcommerceProductAction *)setProductActionList:(NSString *)productActionList; 94 | 95 | /*! 96 | Sets the list source name associated with the products in Google Analytics beacons. This value 97 | is used in kGAIPADetail and kGAIPAClick product actions. 98 | */ 99 | - (GAIEcommerceProductAction *)setProductListSource:(NSString *)productListSource; 100 | 101 | /*! 102 | Builds an NSDictionary of fields stored in this instance representing this product action. 103 |
104 | Normally, users will have no need to call this method. 105 | */ 106 | - (NSDictionary *)build; 107 | @end 108 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIEcommercePromotion.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommercePromotion.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct promotion related fields for Google Analytics hits. The fields from this class 11 | * can be used to represent internal promotions that run within an app, such as banners, banner ads 12 | * etc. 13 | * 14 | * Typical usage: 15 | * 16 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 17 | * GAIEcommercePromotion *promotion = [[GAIEcommercePromotion alloc] init]; 18 | * [promotion setId:@"PROMO-ID1234"]; 19 | * [promotion setName:@"Home screen banner"]; 20 | * [builder set:kGAIPromotionClick forKey:kGAIPromotionAction]; 21 | * [builder addPromotion:promotion]; 22 | * [tracker send:builder.build]]; 23 | * 24 | */ 25 | @interface GAIEcommercePromotion : NSObject 26 | 27 | /*! 28 | Sets the id that is used to identify a promotion in GA reports. 29 | */ 30 | - (GAIEcommercePromotion *)setId:(NSString *)pid; 31 | 32 | /*! 33 | Sets the name that is used to identify a promotion in GA reports. 34 | */ 35 | - (GAIEcommercePromotion *)setName:(NSString *)name; 36 | 37 | /*! 38 | Sets the name of the creative associated with the promotion. 39 | */ 40 | - (GAIEcommercePromotion *)setCreative:(NSString *)creative; 41 | 42 | /*! 43 | Sets the position of the promotion. 44 | */ 45 | - (GAIEcommercePromotion *)setPosition:(NSString *)position; 46 | 47 | /*! 48 | Builds an NSDictionary of fields stored in this instance. The index parameter is the 49 | index of this promotion in that promotion list. 50 |
51 | Normally, users will have no need to call this method. 52 | */ 53 | - (NSDictionary *)buildWithIndex:(NSUInteger)index; 54 | @end 55 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIFields.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIFields.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | These fields can be used for the wire format parameter names required by 11 | the |GAITracker| get, set and send methods as well as the set methods in the 12 | |GAIDictionaryBuilder| class. 13 | */ 14 | extern NSString *const kGAIUseSecure; 15 | 16 | extern NSString *const kGAIHitType; 17 | extern NSString *const kGAITrackingId; 18 | extern NSString *const kGAIClientId; 19 | extern NSString *const kGAIDataSource; 20 | extern NSString *const kGAIAnonymizeIp; 21 | extern NSString *const kGAISessionControl; 22 | extern NSString *const kGAIDeviceModelVersion; 23 | extern NSString *const kGAIScreenResolution; 24 | extern NSString *const kGAIViewportSize; 25 | extern NSString *const kGAIEncoding; 26 | extern NSString *const kGAIScreenColors; 27 | extern NSString *const kGAILanguage; 28 | extern NSString *const kGAIJavaEnabled; 29 | extern NSString *const kGAIFlashVersion; 30 | extern NSString *const kGAINonInteraction; 31 | extern NSString *const kGAIReferrer; 32 | extern NSString *const kGAILocation; 33 | extern NSString *const kGAIHostname; 34 | extern NSString *const kGAIPage; 35 | extern NSString *const kGAIDescription; // synonym for kGAIScreenName 36 | extern NSString *const kGAIScreenName; // synonym for kGAIDescription 37 | extern NSString *const kGAITitle; 38 | extern NSString *const kGAIAdMobHitId; 39 | extern NSString *const kGAIAppName; 40 | extern NSString *const kGAIAppVersion; 41 | extern NSString *const kGAIAppId; 42 | extern NSString *const kGAIAppInstallerId; 43 | extern NSString *const kGAIUserId; 44 | 45 | extern NSString *const kGAIEventCategory; 46 | extern NSString *const kGAIEventAction; 47 | extern NSString *const kGAIEventLabel; 48 | extern NSString *const kGAIEventValue; 49 | 50 | extern NSString *const kGAISocialNetwork; 51 | extern NSString *const kGAISocialAction; 52 | extern NSString *const kGAISocialTarget; 53 | 54 | extern NSString *const kGAITransactionId; 55 | extern NSString *const kGAITransactionAffiliation; 56 | extern NSString *const kGAITransactionRevenue; 57 | extern NSString *const kGAITransactionShipping; 58 | extern NSString *const kGAITransactionTax; 59 | extern NSString *const kGAICurrencyCode; 60 | 61 | extern NSString *const kGAIItemPrice; 62 | extern NSString *const kGAIItemQuantity; 63 | extern NSString *const kGAIItemSku; 64 | extern NSString *const kGAIItemName; 65 | extern NSString *const kGAIItemCategory; 66 | 67 | extern NSString *const kGAICampaignSource; 68 | extern NSString *const kGAICampaignMedium; 69 | extern NSString *const kGAICampaignName; 70 | extern NSString *const kGAICampaignKeyword; 71 | extern NSString *const kGAICampaignContent; 72 | extern NSString *const kGAICampaignId; 73 | extern NSString *const kGAICampaignAdNetworkClickId; 74 | extern NSString *const kGAICampaignAdNetworkId; 75 | 76 | extern NSString *const kGAITimingCategory; 77 | extern NSString *const kGAITimingVar; 78 | extern NSString *const kGAITimingValue; 79 | extern NSString *const kGAITimingLabel; 80 | 81 | extern NSString *const kGAIExDescription; 82 | extern NSString *const kGAIExFatal; 83 | 84 | extern NSString *const kGAISampleRate; 85 | 86 | extern NSString *const kGAIIdfa; 87 | extern NSString *const kGAIAdTargetingEnabled; 88 | 89 | // hit types 90 | extern NSString *const kGAIAppView DEPRECATED_MSG_ATTRIBUTE("Use kGAIScreenView instead."); 91 | extern NSString *const kGAIScreenView; 92 | extern NSString *const kGAIEvent; 93 | extern NSString *const kGAISocial; 94 | extern NSString *const kGAITransaction; 95 | extern NSString *const kGAIItem; 96 | extern NSString *const kGAIException; 97 | extern NSString *const kGAITiming; 98 | 99 | /*! 100 | This class provides several fields and methods useful as wire format parameter 101 | names. The methods are used for wire format parameter names that are indexed. 102 | */ 103 | 104 | @interface GAIFields : NSObject 105 | 106 | /*! 107 | Generates the correct parameter name for a content group with an index. 108 | 109 | @param index the index of the content group. 110 | 111 | @return an NSString representing the content group parameter for the index. 112 | */ 113 | + (NSString *)contentGroupForIndex:(NSUInteger)index; 114 | 115 | /*! 116 | Generates the correct parameter name for a custon dimension with an index. 117 | 118 | @param index the index of the custom dimension. 119 | 120 | @return an NSString representing the custom dimension parameter for the index. 121 | */ 122 | + (NSString *)customDimensionForIndex:(NSUInteger)index; 123 | 124 | /*! 125 | Generates the correct parameter name for a custom metric with an index. 126 | 127 | @param index the index of the custom metric. 128 | 129 | @return an NSString representing the custom metric parameter for the index. 130 | */ 131 | + (NSString *)customMetricForIndex:(NSUInteger)index; 132 | 133 | @end 134 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAIHandler.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "GAIDictionaryBuilder.h" 4 | 5 | void _set(char * parameterName, char * value); 6 | char* _get(char * parameterName); 7 | void _send(NSDictionary * parameters); 8 | void _setProductName(char * name); 9 | void _setProductVersion(char * version); 10 | void _setOptOut(bool optOut); 11 | void _anonymizeIP(); 12 | void _enableIDFACollection(); 13 | void _setDispatchInterval(int time); 14 | void _setTrackUncaughtExceptions(bool trackUncaughtExceptions); 15 | void _setDryRun(bool dryRun); 16 | id _getTrackerWithName(char* name, char* trackingId); 17 | id _getTrackerWithTrackingId(char* trackingId); 18 | void _removeTrackerByName(char* trackingId); 19 | void _dispatch(); 20 | 21 | 22 | @interface GAIHandler : NSObject 23 | 24 | + (void) addAdditionalParametersToBuilder: (GAIDictionaryBuilder*)builder; 25 | @end 26 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAILogger.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAILogger.h 3 | @abstract Google Analytics iOS SDK Source 4 | @copyright Copyright 2011 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | typedef NS_ENUM(NSUInteger, GAILogLevel) { 10 | kGAILogLevelNone = 0, 11 | kGAILogLevelError = 1, 12 | kGAILogLevelWarning = 2, 13 | kGAILogLevelInfo = 3, 14 | kGAILogLevelVerbose = 4 15 | }; 16 | 17 | /*! 18 | Protocol to be used for logging debug and informational messages from the SDK. 19 | Implementations of this protocol can be provided to the |GAI| class, 20 | to be used as the logger by the SDK. See the |logger| property in GAI.h. 21 | */ 22 | @protocol GAILogger 23 | @required 24 | 25 | /*! 26 | Only messages of |logLevel| and below are logged. 27 | */ 28 | @property (nonatomic, assign) GAILogLevel logLevel; 29 | 30 | /*! 31 | Logs message with log level |kGAILogLevelVerbose|. 32 | */ 33 | - (void)verbose:(NSString *)message; 34 | 35 | /*! 36 | Logs message with log level |kGAILogLevelInfo|. 37 | */ 38 | - (void)info:(NSString *)message; 39 | 40 | /*! 41 | Logs message with log level |kGAILogLevelWarning|. 42 | */ 43 | - (void)warning:(NSString *)message; 44 | 45 | /*! 46 | Logs message with log level |kGAILogLevelError|. 47 | */ 48 | - (void)error:(NSString *)message; 49 | @end 50 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAITrackedViewController.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAITrackedViewController.h 3 | @abstract Google Analytics for iOS Tracked View Controller Header 4 | @copyright Copyright 2012 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | #import 9 | 10 | @protocol GAITracker; 11 | 12 | /*! 13 | Extends UIViewController to generate Google Analytics screenview calls 14 | whenever the view appears; this is done by overriding the `viewDidAppear:` 15 | method. The screen name must be set for any tracking calls to be made. 16 | 17 | By default, this will use [GAI defaultTracker] for tracking calls, but one can 18 | override this by setting the tracker property. 19 | */ 20 | @interface GAITrackedViewController : UIViewController 21 | 22 | /*! 23 | The tracker on which view tracking calls are be made, or `nil`, in which case 24 | [GAI defaultTracker] will be used. 25 | */ 26 | @property(nonatomic, assign) id tracker; 27 | /*! 28 | The screen name, for purposes of Google Analytics tracking. If this is `nil`, 29 | no tracking calls will be made. 30 | */ 31 | @property(nonatomic, copy) NSString *screenName; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/GAITracker.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAITracker.h 3 | @abstract Google Analytics iOS SDK Tracker Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | Google Analytics tracking interface. Obtain instances of this interface from 11 | [GAI trackerWithTrackingId:] to track screens, events, transactions, timing, 12 | and exceptions. The implementation of this interface is thread-safe, and no 13 | calls are expected to block or take a long time. All network and disk activity 14 | will take place in the background. 15 | */ 16 | @protocol GAITracker 17 | 18 | /*! 19 | Name of this tracker. 20 | */ 21 | @property(nonatomic, readonly) NSString *name; 22 | 23 | /*! 24 | Allow collection of IDFA and related fields if set to true. Default is false. 25 | */ 26 | @property(nonatomic) BOOL allowIDFACollection; 27 | 28 | /*! 29 | Set a tracking parameter. 30 | 31 | @param parameterName The parameter name. 32 | 33 | @param value The value to set for the parameter. If this is nil, the 34 | value for the parameter will be cleared. 35 | */ 36 | - (void)set:(NSString *)parameterName 37 | value:(NSString *)value; 38 | 39 | /*! 40 | Get a tracking parameter. 41 | 42 | @param parameterName The parameter name. 43 | 44 | @returns The parameter value, or nil if no value for the given parameter is 45 | set. 46 | */ 47 | - (NSString *)get:(NSString *)parameterName; 48 | 49 | /*! 50 | Queue tracking information with the given parameter values. 51 | 52 | @param parameters A map from parameter names to parameter values which will be 53 | set just for this piece of tracking information, or nil for none. 54 | */ 55 | - (void)send:(NSDictionary *)parameters; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/VERSION_3_15: -------------------------------------------------------------------------------- 1 | 3.15 2 | -------------------------------------------------------------------------------- /source/Plugins/iOS-bitcode/libGoogleAnalyticsServices.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/Plugins/iOS-bitcode/libGoogleAnalyticsServices.a -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAI.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAI.h 3 | @abstract Google Analytics iOS SDK Header 4 | @version 3.13 5 | @copyright Copyright 2015 Google Inc. All rights reserved. 6 | */ 7 | 8 | #import 9 | 10 | #import "GAILogger.h" 11 | #import "GAITrackedViewController.h" 12 | #import "GAITracker.h" 13 | 14 | typedef NS_ENUM(NSUInteger, GAIDispatchResult) { 15 | kGAIDispatchNoData, 16 | kGAIDispatchGood, 17 | kGAIDispatchError 18 | }; 19 | 20 | /*! Google Analytics product string. */ 21 | extern NSString *const kGAIProduct; 22 | 23 | /*! Google Analytics version string. */ 24 | extern NSString *const kGAIVersion; 25 | 26 | /*! 27 | NSError objects returned by the Google Analytics SDK may have this error domain 28 | to indicate that the error originated in the Google Analytics SDK. 29 | */ 30 | extern NSString *const kGAIErrorDomain; 31 | 32 | /*! Google Analytics error codes. */ 33 | typedef enum { 34 | // This error code indicates that there was no error. Never used. 35 | kGAINoError = 0, 36 | 37 | // This error code indicates that there was a database-related error. 38 | kGAIDatabaseError, 39 | 40 | // This error code indicates that there was a network-related error. 41 | kGAINetworkError, 42 | } GAIErrorCode; 43 | 44 | /*! 45 | Google Analytics iOS top-level class. Provides facilities to create trackers 46 | and set behaviorial flags. 47 | */ 48 | @interface GAI : NSObject 49 | 50 | /*! 51 | For convenience, this class exposes a default tracker instance. 52 | This is initialized to `nil` and will be set to the first tracker that is 53 | instantiated in trackerWithTrackingId:. It may be overridden as desired. 54 | 55 | The GAITrackedViewController class will, by default, use this tracker instance. 56 | */ 57 | @property(nonatomic, assign) id defaultTracker; 58 | 59 | /*! 60 | The GAILogger to use. 61 | */ 62 | @property(nonatomic, retain) id logger; 63 | 64 | /*! 65 | When this is true, no tracking information will be gathered; tracking calls 66 | will effectively become no-ops. When set to true, all tracking information that 67 | has not yet been submitted. The value of this flag will be persisted 68 | automatically by the SDK. Developers can optionally use this flag to implement 69 | an opt-out setting in the app to allows users to opt out of Google Analytics 70 | tracking. 71 | 72 | This is set to `NO` the first time the Google Analytics SDK is used on a 73 | device, and is persisted thereafter. 74 | */ 75 | @property(nonatomic, assign) BOOL optOut; 76 | 77 | /*! 78 | If this value is positive, tracking information will be automatically 79 | dispatched every dispatchInterval seconds. Otherwise, tracking information must 80 | be sent manually by calling dispatch. 81 | 82 | By default, this is set to `120`, which indicates tracking information should 83 | be dispatched automatically every 120 seconds. 84 | */ 85 | @property(nonatomic, assign) NSTimeInterval dispatchInterval; 86 | 87 | /*! 88 | When set to true, the SDK will record the currently registered uncaught 89 | exception handler, and then register an uncaught exception handler which tracks 90 | the exceptions that occurred using defaultTracker. If defaultTracker is not 91 | `nil`, this function will track the exception on the tracker and attempt to 92 | dispatch any outstanding tracking information for 5 seconds. It will then call 93 | the previously registered exception handler, if any. When set back to false, 94 | the previously registered uncaught exception handler will be restored. 95 | */ 96 | @property(nonatomic, assign) BOOL trackUncaughtExceptions; 97 | 98 | /*! 99 | When this is 'YES', no tracking information will be sent. Defaults to 'NO'. 100 | */ 101 | @property(nonatomic, assign) BOOL dryRun; 102 | 103 | /*! Get the shared instance of the Google Analytics for iOS class. */ 104 | + (GAI *)sharedInstance; 105 | 106 | /*! 107 | Creates or retrieves a GAITracker implementation with the specified name and 108 | tracking ID. If the tracker for the specified name does not already exist, then 109 | it will be created and returned; otherwise, the existing tracker will be 110 | returned. If the existing tracker for the respective name has a different 111 | tracking ID, that tracking ID is not changed by this method. If defaultTracker 112 | is not set, it will be set to the tracker instance returned here. 113 | 114 | @param name The name of this tracker. Must not be `nil` or empty. 115 | 116 | @param trackingID The tracking ID to use for this tracker. It should be of 117 | the form `UA-xxxxx-y`. 118 | 119 | @return A GAITracker associated with the specified name. The tracker 120 | can be used to send tracking data to Google Analytics. The first time this 121 | method is called with a particular name, the tracker for that name will be 122 | returned, and subsequent calls with the same name will return the same 123 | instance. It is not necessary to retain the tracker because the tracker will be 124 | retained internally by the library. 125 | 126 | If an error occurs or the name is not valid, this method will return 127 | `nil`. 128 | */ 129 | - (id)trackerWithName:(NSString *)name 130 | trackingId:(NSString *)trackingId; 131 | 132 | /*! 133 | Creates or retrieves a GAITracker implementation with name equal to 134 | the specified tracking ID. If the tracker for the respective name does not 135 | already exist, it is created, has it's tracking ID set to |trackingId|, 136 | and is returned; otherwise, the existing tracker is returned. If the existing 137 | tracker for the respective name has a different tracking ID, that tracking ID 138 | is not changed by this method. If defaultTracker is not set, it is set to the 139 | tracker instance returned here. 140 | 141 | @param trackingID The tracking ID to use for this tracker. It should be of 142 | the form `UA-xxxxx-y`. The name of the tracker will be the same as trackingID. 143 | 144 | @return A GAITracker associated with the specified trackingID. The tracker 145 | can be used to send tracking data to Google Analytics. The first time this 146 | method is called with a particular trackingID, the tracker for the respective 147 | name will be returned, and subsequent calls with the same trackingID 148 | will return the same instance. It is not necessary to retain the tracker 149 | because the tracker will be retained internally by the library. 150 | 151 | If an error occurs or the trackingId is not valid, this method will return 152 | `nil`. 153 | */ 154 | - (id)trackerWithTrackingId:(NSString *)trackingId; 155 | 156 | /*! 157 | Remove a tracker from the trackers dictionary. If it is the default tracker, 158 | clears the default tracker as well. 159 | 160 | @param name The name of the tracker. 161 | */ 162 | - (void)removeTrackerByName:(NSString *)name; 163 | 164 | /*! 165 | Dispatches any pending tracking information. 166 | 167 | Note that this does not have any effect on dispatchInterval, and can be used in 168 | conjunction with periodic dispatch. */ 169 | - (void)dispatch; 170 | 171 | /*! 172 | Dispatches the next tracking beacon in the queue, calling completionHandler when 173 | the tracking beacon has either been sent (returning kGAIDispatchGood) or an error has resulted 174 | (returning kGAIDispatchError). If there is no network connection or there is no data to send, 175 | kGAIDispatchNoData is returned. 176 | 177 | Note that calling this method with a non-nil completionHandler disables periodic dispatch. 178 | Periodic dispatch can be reenabled by setting the dispatchInterval to a positive number when 179 | the app resumes from the background. 180 | 181 | Calling this method with a nil completionHandler is the same as calling the dispatch 182 | above. 183 | 184 | This method can be used for background data fetching in iOS 7.0 or later. It would be wise to 185 | call this when the application is exiting to initiate the submission of any unsubmitted 186 | tracking information. 187 | 188 | @param completionHandler The block to run after a single dispatch request. The GAIDispatchResult 189 | param indicates whether the dispatch succeeded, had an error, or had no hits to dispatch. 190 | */ 191 | - (void)dispatchWithCompletionHandler:(void (^)(GAIDispatchResult result))completionHandler; 192 | @end 193 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIDictionaryBuilder.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIDictionaryBuilder.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | #import "GAIEcommerceProduct.h" 10 | #import "GAIEcommerceProductAction.h" 11 | #import "GAIEcommercePromotion.h" 12 | 13 | /*! 14 | * Helper class to build a dictionary of hit parameters and values. 15 | *
16 | * Examples: 17 | * 18 | * id t = // get a tracker. 19 | * [t send:[[[GAIDictionaryBuilder createEventWithCategory:@"EventCategory" 20 | * action:@"EventAction" 21 | * label:nil 22 | * value:nil] 23 | * set:@"dimension1" forKey:[GAIFields customDimensionForIndex:1]] build]]; 24 | * 25 | * This will send an event hit type with the specified parameters 26 | * and a custom dimension parameter. 27 | *
28 | * If you want to send a parameter with all hits, set it on GAITracker directly. 29 | * 30 | * [t set:kGAIScreenName value:@"Home"]; 31 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 32 | * action:@"PlusOne" 33 | * target:@"SOME_URL"] build]]; 34 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 35 | * action:@"Share" 36 | * target:@"SOME_POST"] build]]; 37 | * [t send:[[GAIDictionaryBuilder createSocialWithNetwork:@"Google+" 38 | * action:@"HangOut" 39 | * target:@"SOME_CIRCLE"] 40 | * build]]; 41 | * 42 | * You can override a value set on the tracker by adding it to the dictionary. 43 | * 44 | * [t set:kGAIScreenName value:@"Home"]; 45 | * [t send:...]; 46 | * [t send[[[GAIDictionaryBuilder createEventWithCategory:@"click" 47 | * action:@"popup" 48 | * label:nil 49 | * value:nil] 50 | * set:@"popup title" forKey:kGAIScreenName] build]]; 51 | * 52 | * The values set via [GAIDictionaryBuilder set] or 53 | * [GAIDictionaryBuilder setAll] will override any existing values in the 54 | * GAIDictionaryBuilder object (i.e. initialized by 55 | * [GAIDictionaryBuilder createXYZ]). e.g. 56 | * 57 | * GAIDictionaryBuilder *m = 58 | * GAIDictionaryBuilder createTimingWithCategory:@"category" 59 | * interval:@0 60 | * name:@"name" 61 | * label:nil]; 62 | * [t send:[m.set:@"10" forKey:kGAITimingVar] build]; 63 | * [t send:[m.set:@"20" forKey:kGAITimingVar] build]; 64 | * 65 | */ 66 | @interface GAIDictionaryBuilder : NSObject 67 | 68 | - (GAIDictionaryBuilder *)set:(NSString *)value 69 | forKey:(NSString *)key; 70 | 71 | /*! 72 | * Copies all the name-value pairs from params into this object, ignoring any 73 | * keys that are not NSString and any values that are neither NSString or 74 | * NSNull. 75 | */ 76 | - (GAIDictionaryBuilder *)setAll:(NSDictionary *)params; 77 | 78 | /*! 79 | * Returns the value for the input parameter paramName, or nil if paramName 80 | * is not present. 81 | */ 82 | - (NSString *)get:(NSString *)paramName; 83 | 84 | /*! 85 | * Return an NSMutableDictionary object with all the parameters set in this 86 | */ 87 | - (NSMutableDictionary *)build; 88 | 89 | /*! 90 | * Parses and translates utm campaign parameters to analytics campaign param 91 | * and returns them as a map. 92 | * 93 | * @param params url containing utm campaign parameters. 94 | * 95 | * Valid campaign parameters are: 96 | *

    97 | *
  • utm_id
  • 98 | *
  • utm_campaign
  • 99 | *
  • utm_content
  • 100 | *
  • utm_medium
  • 101 | *
  • utm_source
  • 102 | *
  • utm_term
  • 103 | *
  • dclid
  • 104 | *
  • gclid
  • 105 | *
  • gmob_t
  • 106 | *
  • aclid
  • 107 | *
  • anid
  • 108 | *
109 | *

110 | * Example: 111 | * http://my.site.com/index.html?utm_campaign=wow&utm_source=source 112 | * utm_campaign=wow&utm_source=source. 113 | *

114 | * For more information on auto-tagging, see 115 | * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55590 116 | *

117 | * For more information on manual tagging, see 118 | * http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55518 119 | */ 120 | - (GAIDictionaryBuilder *)setCampaignParametersFromUrl:(NSString *)urlString; 121 | 122 | /*! 123 | Returns a GAIDictionaryBuilder object with parameters specific to an appview 124 | hit. 125 | 126 | Note that using this method will not set the screen name for followon hits. To 127 | do that you need to call set:kGAIDescription value: on the 128 | GAITracker instance. 129 | 130 | This method is deprecated. Use createScreenView instead. 131 | */ 132 | + (GAIDictionaryBuilder *)createAppView DEPRECATED_MSG_ATTRIBUTE("Use createScreenView instead."); 133 | 134 | /*! 135 | Returns a GAIDictionaryBuilder object with parameters specific to a screenview 136 | hit. 137 | 138 | Note that using this method will not set the screen name for followon hits. To 139 | do that you need to call set:kGAIDescription value: on the 140 | GAITracker instance. 141 | */ 142 | + (GAIDictionaryBuilder *)createScreenView; 143 | 144 | /*! 145 | Returns a GAIDictionaryBuilder object with parameters specific to an event hit. 146 | */ 147 | + (GAIDictionaryBuilder *)createEventWithCategory:(NSString *)category 148 | action:(NSString *)action 149 | label:(NSString *)label 150 | value:(NSNumber *)value; 151 | 152 | /*! 153 | Returns a GAIDictionaryBuilder object with parameters specific to an exception 154 | hit. 155 | */ 156 | + (GAIDictionaryBuilder *)createExceptionWithDescription:(NSString *)description 157 | withFatal:(NSNumber *)fatal; 158 | 159 | /*! 160 | Returns a GAIDictionaryBuilder object with parameters specific to an item hit. 161 | */ 162 | + (GAIDictionaryBuilder *)createItemWithTransactionId:(NSString *)transactionId 163 | name:(NSString *)name 164 | sku:(NSString *)sku 165 | category:(NSString *)category 166 | price:(NSNumber *)price 167 | quantity:(NSNumber *)quantity 168 | currencyCode:(NSString *)currencyCode; 169 | 170 | /*! 171 | Returns a GAIDictionaryBuilder object with parameters specific to a social hit. 172 | */ 173 | + (GAIDictionaryBuilder *)createSocialWithNetwork:(NSString *)network 174 | action:(NSString *)action 175 | target:(NSString *)target; 176 | 177 | /*! 178 | Returns a GAIDictionaryBuilder object with parameters specific to a timing hit. 179 | */ 180 | + (GAIDictionaryBuilder *)createTimingWithCategory:(NSString *)category 181 | interval:(NSNumber *)intervalMillis 182 | name:(NSString *)name 183 | label:(NSString *)label; 184 | 185 | /*! 186 | Returns a GAIDictionaryBuilder object with parameters specific to a transaction 187 | hit. 188 | */ 189 | + (GAIDictionaryBuilder *)createTransactionWithId:(NSString *)transactionId 190 | affiliation:(NSString *)affiliation 191 | revenue:(NSNumber *)revenue 192 | tax:(NSNumber *)tax 193 | shipping:(NSNumber *)shipping 194 | currencyCode:(NSString *)currencyCode; 195 | 196 | /*! 197 | Set the product action field for this hit. 198 | */ 199 | - (GAIDictionaryBuilder *)setProductAction:(GAIEcommerceProductAction *)productAction; 200 | 201 | /*! 202 | Adds a product to this hit. 203 | */ 204 | - (GAIDictionaryBuilder *)addProduct:(GAIEcommerceProduct *)product; 205 | 206 | /*! 207 | Add a product impression to this hit. 208 | */ 209 | - (GAIDictionaryBuilder *)addProductImpression:(GAIEcommerceProduct *)product 210 | impressionList:(NSString *)name 211 | impressionSource:(NSString *)source; 212 | 213 | /*! 214 | Add a promotion to this hit. 215 | */ 216 | - (GAIDictionaryBuilder *)addPromotion:(GAIEcommercePromotion *)promotion; 217 | @end 218 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIEcommerceFields.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommerceFields.h 3 | @abstract Google Analytics iOS SDK Ecommerce Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | This class provides several fields and methods useful as wire format parameters for 11 | Enhanced Ecommerce. See the online developer guides for Enhanced Ecommerce for details 12 | on how to use the Enhanced Ecommerce features. 13 | */ 14 | 15 | // Enhanced Ecommerce Product fields 16 | extern NSString *const kGAIProductId; 17 | extern NSString *const kGAIProductName; 18 | extern NSString *const kGAIProductBrand; 19 | extern NSString *const kGAIProductCategory; 20 | extern NSString *const kGAIProductVariant; 21 | extern NSString *const kGAIProductPrice; 22 | extern NSString *const kGAIProductQuantity; 23 | extern NSString *const kGAIProductCouponCode; 24 | extern NSString *const kGAIProductPosition; 25 | 26 | extern NSString *const kGAIProductAction; 27 | 28 | // product action values 29 | extern NSString *const kGAIPADetail; 30 | extern NSString *const kGAIPAClick; 31 | extern NSString *const kGAIPAAdd; 32 | extern NSString *const kGAIPARemove; 33 | extern NSString *const kGAIPACheckout; 34 | extern NSString *const kGAIPACheckoutOption; 35 | extern NSString *const kGAIPAPurchase; 36 | extern NSString *const kGAIPARefund; 37 | 38 | // product action fields 39 | // used for 'purchase' and 'refund' actions 40 | extern NSString *const kGAIPATransactionId; 41 | extern NSString *const kGAIPAAffiliation; 42 | extern NSString *const kGAIPARevenue; 43 | extern NSString *const kGAIPATax; 44 | extern NSString *const kGAIPAShipping; 45 | extern NSString *const kGAIPACouponCode; 46 | // used for 'checkout' action 47 | extern NSString *const kGAICheckoutStep; 48 | extern NSString *const kGAICheckoutOption; 49 | // used for 'detail' and 'click' actions 50 | extern NSString *const kGAIProductActionList; 51 | extern NSString *const kGAIProductListSource; 52 | 53 | // Enhanced Ecommerce Impressions fields 54 | extern NSString *const kGAIImpressionName; 55 | extern NSString *const kGAIImpressionListSource; 56 | extern NSString *const kGAIImpressionProduct; 57 | extern NSString *const kGAIImpressionProductId; 58 | extern NSString *const kGAIImpressionProductName; 59 | extern NSString *const kGAIImpressionProductBrand; 60 | extern NSString *const kGAIImpressionProductCategory; 61 | extern NSString *const kGAIImpressionProductVariant; 62 | extern NSString *const kGAIImpressionProductPosition; 63 | extern NSString *const kGAIImpressionProductPrice; 64 | 65 | // Enhanced Ecommerce Promotions fields 66 | extern NSString *const kGAIPromotionId; 67 | extern NSString *const kGAIPromotionName; 68 | extern NSString *const kGAIPromotionCreative; 69 | extern NSString *const kGAIPromotionPosition; 70 | 71 | // Promotion actions 72 | extern NSString *const kGAIPromotionAction; 73 | extern NSString *const kGAIPromotionView; 74 | extern NSString *const kGAIPromotionClick; 75 | 76 | @interface GAIEcommerceFields : NSObject 77 | 78 | /*! 79 | Generates an enhanced ecommerce product field. Note that field names generated by 80 | customDimensionForIndex and customMetricForIndex can be used as suffixes. 81 | 82 | @param index the index of the product 83 | @param suffix the product field suffix (such as kGAIProductPrice). 84 | 85 | @return an NSString representing the product field parameter 86 | */ 87 | + (NSString *)productFieldForIndex:(NSUInteger)index suffix:(NSString *)suffix; 88 | 89 | /*! 90 | Genrates an enhanced ecommerce impression list field name with an index. The return value of 91 | this method should also be used as input to the productImpressionForList method below. 92 | 93 | @param index the index of the impression list 94 | 95 | @return an NSString representing the impression list parameter 96 | */ 97 | + (NSString *)impressionListForIndex:(NSUInteger)index; 98 | 99 | /*! 100 | Generates an enhanced ecommerce product impression field with the impression list, product index 101 | and product suffix as parameters. The output of the method impressionListForIndex above should be 102 | used as the input list for this method. The output of customDimensionForIndex and 103 | customMetricForIndex can be used as suffixes. 104 | 105 | @param list the impression list for this product impression 106 | @param index the index of this product in the impression list 107 | @param suffix the product impression suffix for this field 108 | 109 | @return an NSString representing this product impression field parameter 110 | */ 111 | + (NSString *)productImpressionForList:(NSString *)list 112 | index:(NSUInteger)index 113 | suffix:(NSString *)Suffix; 114 | 115 | /*! 116 | Generates an enhanced ecommerce promotion field with an index and suffix. 117 | 118 | @param index the index of the promotion 119 | @param suffix the promotion suffix (such as kGAIPromotionId) 120 | 121 | @return an NSString representing this promotion field paramter 122 | */ 123 | + (NSString *)promotionForIndex:(NSUInteger)index suffix:(NSString *)suffix; 124 | @end 125 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIEcommerceProduct.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommerceProduct.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct product related information for a Google Analytics beacon. Use this class to 11 | * report information about products sold by merchants or impressions of products seen by users. 12 | * Instances of this class can be associated with both Product Actions and Product 13 | * Impression Lists. 14 | *
15 | * Typical usage: 16 | * 17 | * [tracker set:kGAIScreenName value:@"MyScreen"]; 18 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 19 | * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; 20 | * [product setId:@""PID-1234""]; 21 | * [product setName:@"Space Monkeys!"]; 22 | * [product setPrice:@100]; 23 | * [product setQuantity:@2]; 24 | * [builder addProductImpression:product impressionList:@"listName"]; 25 | * [tracker send:[builder build]]; 26 | * 27 | */ 28 | @interface GAIEcommerceProduct : NSObject 29 | 30 | /*! 31 | Sets the id that is used to identify a product in GA reports. 32 | */ 33 | - (GAIEcommerceProduct *)setId:(NSString *)productId; 34 | 35 | /*! 36 | Sets the name that is used to indentify the product in GA reports. 37 | */ 38 | - (GAIEcommerceProduct *)setName:(NSString *)productName; 39 | 40 | /*! 41 | Sets the brand associated with the product in GA reports. 42 | */ 43 | - (GAIEcommerceProduct *)setBrand:(NSString *)productBrand; 44 | 45 | /*! 46 | Sets the category associated with the product in GA reports. 47 | */ 48 | - (GAIEcommerceProduct *)setCategory:(NSString *)productCategory; 49 | 50 | /*! 51 | Sets the variant of the product. 52 | */ 53 | - (GAIEcommerceProduct *)setVariant:(NSString *)productVariant; 54 | 55 | /*! 56 | Sets the price of the product. 57 | */ 58 | - (GAIEcommerceProduct *)setPrice:(NSNumber *)productPrice; 59 | 60 | /*! 61 | Sets the quantity of the product. This field is usually not used with product impressions. 62 | */ 63 | - (GAIEcommerceProduct *)setQuantity:(NSNumber *)productQuantity; 64 | 65 | /*! 66 | Sets the coupon code associated with the product. This field is usually not used with product 67 | impressions. 68 | */ 69 | - (GAIEcommerceProduct *)setCouponCode:(NSString *)productCouponCode; 70 | 71 | /*! 72 | Sets the position of the product on the screen/product impression list, etc. 73 | */ 74 | - (GAIEcommerceProduct *)setPosition:(NSNumber *)productPosition; 75 | 76 | /*! 77 | Sets the custom dimension associated with this product. 78 | */ 79 | - (GAIEcommerceProduct *)setCustomDimension:(NSUInteger)index value:(NSString *)value; 80 | 81 | /*! 82 | Sets the custom metric associated with this product. 83 | */ 84 | - (GAIEcommerceProduct *)setCustomMetric:(NSUInteger)index value:(NSNumber *)value; 85 | 86 | /*! 87 | Builds an NSDictionary of fields stored in this instance suitable for a product action. The 88 | index parameter is the index of this product in the product action list. 89 |
90 | Normally, users will have no need to call this method. 91 | */ 92 | - (NSDictionary *)buildWithIndex:(NSUInteger)index; 93 | 94 | /*! 95 | Builds an NSDictionary of fields stored in this instance suitable for an impression list. The 96 | lIndex parameter is the index of the product impression list while the index parameter is the 97 | index of this product in that impression list. 98 |
99 | Normally, users will have no need to call this method. 100 | */ 101 | - (NSDictionary *)buildWithListIndex:(NSUInteger)lIndex index:(NSUInteger)index; 102 | @end 103 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIEcommerceProductAction.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIProductAction.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct transaction/checkout or other product interaction related information for a 11 | * Google Analytics hit. Use this class to report information about products sold, viewed or 12 | * refunded. This class is intended to be used with GAIDictionaryBuilder. 13 | *
14 | * Typical usage: 15 | * 16 | * [tracker set:kGAIScreenName value:@"MyScreen"]; 17 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 18 | * GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init]; 19 | * [action setAction:kGAIPAPurchase]; 20 | * [action setTransactionId:@"TT-1234"]; 21 | * [action setRevenue:@3.14]; 22 | * [action setCouponCode:@"EXTRA100"]; 23 | * [builder setProductAction:action]; 24 | * GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; 25 | * [product setId:@""PID-1234""]; 26 | * [product setName:@"Space Monkeys!"]; 27 | * [product setPrice:@100]; 28 | * [product setQuantity:@2]; 29 | * [builder addProduct:product]; 30 | * [tracker send:[builder build]]; 31 | * 32 | */ 33 | @interface GAIEcommerceProductAction : NSObject 34 | 35 | /*! 36 | Sets the product action field for this product action. Valid values can be found in 37 | GAIEcommerceFields.h under "product action values". 38 | */ 39 | - (GAIEcommerceProductAction *)setAction:(NSString *)productAction; 40 | 41 | /*! 42 | The unique id associated with the transaction. This value is used for kGAIPAPurchase and 43 | kGAIPARefund product actions. 44 | */ 45 | - (GAIEcommerceProductAction *)setTransactionId:(NSString *)transactionId; 46 | 47 | /*! 48 | Sets the transaction's affiliation value. This value is used for kGAIPAPurchase and 49 | kGAIPARefund product actions. 50 | */ 51 | - (GAIEcommerceProductAction *)setAffiliation:(NSString *)affiliation; 52 | 53 | /*! 54 | Sets the transaction's total revenue. This value is used for kGAIPAPurchase and kGAIPARefund 55 | product actions. 56 | */ 57 | - (GAIEcommerceProductAction *)setRevenue:(NSNumber *)revenue; 58 | 59 | /*! 60 | Sets the transaction's total tax. This value is used for kGAIPAPurchase and kGAIPARefund 61 | product actions. 62 | */ 63 | - (GAIEcommerceProductAction *)setTax:(NSNumber *)tax; 64 | 65 | /*! 66 | Sets the transaction's total shipping costs. This value is used for kGAIPAPurchase and 67 | kGAIPARefund product actions. 68 | */ 69 | - (GAIEcommerceProductAction *)setShipping:(NSNumber *)shipping; 70 | 71 | /*! 72 | Sets the coupon code used in this transaction. This value is used for kGAIPAPurchase and 73 | kGAIPARefund product actions. 74 | */ 75 | - (GAIEcommerceProductAction *)setCouponCode:(NSString *)couponCode; 76 | 77 | /*! 78 | Sets the checkout process's progress. This value is used for kGAICheckout and 79 | kGAICheckoutOptions product actions. 80 | */ 81 | - (GAIEcommerceProductAction *)setCheckoutStep:(NSNumber *)checkoutStep; 82 | 83 | /*! 84 | Sets the option associated with the checkout. This value is used for kGAICheckout and 85 | kGAICheckoutOptions product actions. 86 | */ 87 | - (GAIEcommerceProductAction *)setCheckoutOption:(NSString *)checkoutOption; 88 | 89 | /*! 90 | Sets the list name associated with the products in Google Analytics beacons. This value is 91 | used in kGAIPADetail and kGAIPAClick product actions. 92 | */ 93 | - (GAIEcommerceProductAction *)setProductActionList:(NSString *)productActionList; 94 | 95 | /*! 96 | Sets the list source name associated with the products in Google Analytics beacons. This value 97 | is used in kGAIPADetail and kGAIPAClick product actions. 98 | */ 99 | - (GAIEcommerceProductAction *)setProductListSource:(NSString *)productListSource; 100 | 101 | /*! 102 | Builds an NSDictionary of fields stored in this instance representing this product action. 103 |
104 | Normally, users will have no need to call this method. 105 | */ 106 | - (NSDictionary *)build; 107 | @end 108 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIEcommercePromotion.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIEcommercePromotion.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2014 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | * Class to construct promotion related fields for Google Analytics hits. The fields from this class 11 | * can be used to represent internal promotions that run within an app, such as banners, banner ads 12 | * etc. 13 | * 14 | * Typical usage: 15 | * 16 | * GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; 17 | * GAIEcommercePromotion *promotion = [[GAIEcommercePromotion alloc] init]; 18 | * [promotion setId:@"PROMO-ID1234"]; 19 | * [promotion setName:@"Home screen banner"]; 20 | * [builder set:kGAIPromotionClick forKey:kGAIPromotionAction]; 21 | * [builder addPromotion:promotion]; 22 | * [tracker send:builder.build]]; 23 | * 24 | */ 25 | @interface GAIEcommercePromotion : NSObject 26 | 27 | /*! 28 | Sets the id that is used to identify a promotion in GA reports. 29 | */ 30 | - (GAIEcommercePromotion *)setId:(NSString *)pid; 31 | 32 | /*! 33 | Sets the name that is used to identify a promotion in GA reports. 34 | */ 35 | - (GAIEcommercePromotion *)setName:(NSString *)name; 36 | 37 | /*! 38 | Sets the name of the creative associated with the promotion. 39 | */ 40 | - (GAIEcommercePromotion *)setCreative:(NSString *)creative; 41 | 42 | /*! 43 | Sets the position of the promotion. 44 | */ 45 | - (GAIEcommercePromotion *)setPosition:(NSString *)position; 46 | 47 | /*! 48 | Builds an NSDictionary of fields stored in this instance. The index parameter is the 49 | index of this promotion in that promotion list. 50 |
51 | Normally, users will have no need to call this method. 52 | */ 53 | - (NSDictionary *)buildWithIndex:(NSUInteger)index; 54 | @end 55 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIFields.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAIFields.h 3 | @abstract Google Analytics iOS SDK Hit Format Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | These fields can be used for the wire format parameter names required by 11 | the |GAITracker| get, set and send methods as well as the set methods in the 12 | |GAIDictionaryBuilder| class. 13 | */ 14 | extern NSString *const kGAIUseSecure; 15 | 16 | extern NSString *const kGAIHitType; 17 | extern NSString *const kGAITrackingId; 18 | extern NSString *const kGAIClientId; 19 | extern NSString *const kGAIDataSource; 20 | extern NSString *const kGAIAnonymizeIp; 21 | extern NSString *const kGAISessionControl; 22 | extern NSString *const kGAIDeviceModelVersion; 23 | extern NSString *const kGAIScreenResolution; 24 | extern NSString *const kGAIViewportSize; 25 | extern NSString *const kGAIEncoding; 26 | extern NSString *const kGAIScreenColors; 27 | extern NSString *const kGAILanguage; 28 | extern NSString *const kGAIJavaEnabled; 29 | extern NSString *const kGAIFlashVersion; 30 | extern NSString *const kGAINonInteraction; 31 | extern NSString *const kGAIReferrer; 32 | extern NSString *const kGAILocation; 33 | extern NSString *const kGAIHostname; 34 | extern NSString *const kGAIPage; 35 | extern NSString *const kGAIDescription; // synonym for kGAIScreenName 36 | extern NSString *const kGAIScreenName; // synonym for kGAIDescription 37 | extern NSString *const kGAITitle; 38 | extern NSString *const kGAIAdMobHitId; 39 | extern NSString *const kGAIAppName; 40 | extern NSString *const kGAIAppVersion; 41 | extern NSString *const kGAIAppId; 42 | extern NSString *const kGAIAppInstallerId; 43 | extern NSString *const kGAIUserId; 44 | 45 | extern NSString *const kGAIEventCategory; 46 | extern NSString *const kGAIEventAction; 47 | extern NSString *const kGAIEventLabel; 48 | extern NSString *const kGAIEventValue; 49 | 50 | extern NSString *const kGAISocialNetwork; 51 | extern NSString *const kGAISocialAction; 52 | extern NSString *const kGAISocialTarget; 53 | 54 | extern NSString *const kGAITransactionId; 55 | extern NSString *const kGAITransactionAffiliation; 56 | extern NSString *const kGAITransactionRevenue; 57 | extern NSString *const kGAITransactionShipping; 58 | extern NSString *const kGAITransactionTax; 59 | extern NSString *const kGAICurrencyCode; 60 | 61 | extern NSString *const kGAIItemPrice; 62 | extern NSString *const kGAIItemQuantity; 63 | extern NSString *const kGAIItemSku; 64 | extern NSString *const kGAIItemName; 65 | extern NSString *const kGAIItemCategory; 66 | 67 | extern NSString *const kGAICampaignSource; 68 | extern NSString *const kGAICampaignMedium; 69 | extern NSString *const kGAICampaignName; 70 | extern NSString *const kGAICampaignKeyword; 71 | extern NSString *const kGAICampaignContent; 72 | extern NSString *const kGAICampaignId; 73 | extern NSString *const kGAICampaignAdNetworkClickId; 74 | extern NSString *const kGAICampaignAdNetworkId; 75 | 76 | extern NSString *const kGAITimingCategory; 77 | extern NSString *const kGAITimingVar; 78 | extern NSString *const kGAITimingValue; 79 | extern NSString *const kGAITimingLabel; 80 | 81 | extern NSString *const kGAIExDescription; 82 | extern NSString *const kGAIExFatal; 83 | 84 | extern NSString *const kGAISampleRate; 85 | 86 | extern NSString *const kGAIIdfa; 87 | extern NSString *const kGAIAdTargetingEnabled; 88 | 89 | // hit types 90 | extern NSString *const kGAIAppView DEPRECATED_MSG_ATTRIBUTE("Use kGAIScreenView instead."); 91 | extern NSString *const kGAIScreenView; 92 | extern NSString *const kGAIEvent; 93 | extern NSString *const kGAISocial; 94 | extern NSString *const kGAITransaction; 95 | extern NSString *const kGAIItem; 96 | extern NSString *const kGAIException; 97 | extern NSString *const kGAITiming; 98 | 99 | /*! 100 | This class provides several fields and methods useful as wire format parameter 101 | names. The methods are used for wire format parameter names that are indexed. 102 | */ 103 | 104 | @interface GAIFields : NSObject 105 | 106 | /*! 107 | Generates the correct parameter name for a content group with an index. 108 | 109 | @param index the index of the content group. 110 | 111 | @return an NSString representing the content group parameter for the index. 112 | */ 113 | + (NSString *)contentGroupForIndex:(NSUInteger)index; 114 | 115 | /*! 116 | Generates the correct parameter name for a custon dimension with an index. 117 | 118 | @param index the index of the custom dimension. 119 | 120 | @return an NSString representing the custom dimension parameter for the index. 121 | */ 122 | + (NSString *)customDimensionForIndex:(NSUInteger)index; 123 | 124 | /*! 125 | Generates the correct parameter name for a custom metric with an index. 126 | 127 | @param index the index of the custom metric. 128 | 129 | @return an NSString representing the custom metric parameter for the index. 130 | */ 131 | + (NSString *)customMetricForIndex:(NSUInteger)index; 132 | 133 | @end 134 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAIHandler.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "GAIDictionaryBuilder.h" 4 | 5 | void _set(char * parameterName, char * value); 6 | char* _get(char * parameterName); 7 | void _send(NSDictionary * parameters); 8 | void _setProductName(char * name); 9 | void _setProductVersion(char * version); 10 | void _setOptOut(bool optOut); 11 | void _anonymizeIP(); 12 | void _enableIDFACollection(); 13 | void _setDispatchInterval(int time); 14 | void _setTrackUncaughtExceptions(bool trackUncaughtExceptions); 15 | void _setDryRun(bool dryRun); 16 | id _getTrackerWithName(char* name, char* trackingId); 17 | id _getTrackerWithTrackingId(char* trackingId); 18 | void _removeTrackerByName(char* trackingId); 19 | void _dispatch(); 20 | 21 | 22 | @interface GAIHandler : NSObject 23 | 24 | + (void) addAdditionalParametersToBuilder: (GAIDictionaryBuilder*)builder; 25 | @end 26 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAILogger.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAILogger.h 3 | @abstract Google Analytics iOS SDK Source 4 | @copyright Copyright 2011 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | typedef NS_ENUM(NSUInteger, GAILogLevel) { 10 | kGAILogLevelNone = 0, 11 | kGAILogLevelError = 1, 12 | kGAILogLevelWarning = 2, 13 | kGAILogLevelInfo = 3, 14 | kGAILogLevelVerbose = 4 15 | }; 16 | 17 | /*! 18 | Protocol to be used for logging debug and informational messages from the SDK. 19 | Implementations of this protocol can be provided to the |GAI| class, 20 | to be used as the logger by the SDK. See the |logger| property in GAI.h. 21 | */ 22 | @protocol GAILogger 23 | @required 24 | 25 | /*! 26 | Only messages of |logLevel| and below are logged. 27 | */ 28 | @property (nonatomic, assign) GAILogLevel logLevel; 29 | 30 | /*! 31 | Logs message with log level |kGAILogLevelVerbose|. 32 | */ 33 | - (void)verbose:(NSString *)message; 34 | 35 | /*! 36 | Logs message with log level |kGAILogLevelInfo|. 37 | */ 38 | - (void)info:(NSString *)message; 39 | 40 | /*! 41 | Logs message with log level |kGAILogLevelWarning|. 42 | */ 43 | - (void)warning:(NSString *)message; 44 | 45 | /*! 46 | Logs message with log level |kGAILogLevelError|. 47 | */ 48 | - (void)error:(NSString *)message; 49 | @end 50 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAITrackedViewController.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAITrackedViewController.h 3 | @abstract Google Analytics for iOS Tracked View Controller Header 4 | @copyright Copyright 2012 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | #import 9 | 10 | @protocol GAITracker; 11 | 12 | /*! 13 | Extends UIViewController to generate Google Analytics screenview calls 14 | whenever the view appears; this is done by overriding the `viewDidAppear:` 15 | method. The screen name must be set for any tracking calls to be made. 16 | 17 | By default, this will use [GAI defaultTracker] for tracking calls, but one can 18 | override this by setting the tracker property. 19 | */ 20 | @interface GAITrackedViewController : UIViewController 21 | 22 | /*! 23 | The tracker on which view tracking calls are be made, or `nil`, in which case 24 | [GAI defaultTracker] will be used. 25 | */ 26 | @property(nonatomic, assign) id tracker; 27 | /*! 28 | The screen name, for purposes of Google Analytics tracking. If this is `nil`, 29 | no tracking calls will be made. 30 | */ 31 | @property(nonatomic, copy) NSString *screenName; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/GAITracker.h: -------------------------------------------------------------------------------- 1 | /*! 2 | @header GAITracker.h 3 | @abstract Google Analytics iOS SDK Tracker Header 4 | @copyright Copyright 2013 Google Inc. All rights reserved. 5 | */ 6 | 7 | #import 8 | 9 | /*! 10 | Google Analytics tracking interface. Obtain instances of this interface from 11 | [GAI trackerWithTrackingId:] to track screens, events, transactions, timing, 12 | and exceptions. The implementation of this interface is thread-safe, and no 13 | calls are expected to block or take a long time. All network and disk activity 14 | will take place in the background. 15 | */ 16 | @protocol GAITracker 17 | 18 | /*! 19 | Name of this tracker. 20 | */ 21 | @property(nonatomic, readonly) NSString *name; 22 | 23 | /*! 24 | Allow collection of IDFA and related fields if set to true. Default is false. 25 | */ 26 | @property(nonatomic) BOOL allowIDFACollection; 27 | 28 | /*! 29 | Set a tracking parameter. 30 | 31 | @param parameterName The parameter name. 32 | 33 | @param value The value to set for the parameter. If this is nil, the 34 | value for the parameter will be cleared. 35 | */ 36 | - (void)set:(NSString *)parameterName 37 | value:(NSString *)value; 38 | 39 | /*! 40 | Get a tracking parameter. 41 | 42 | @param parameterName The parameter name. 43 | 44 | @returns The parameter value, or nil if no value for the given parameter is 45 | set. 46 | */ 47 | - (NSString *)get:(NSString *)parameterName; 48 | 49 | /*! 50 | Queue tracking information with the given parameter values. 51 | 52 | @param parameters A map from parameter names to parameter values which will be 53 | set just for this piece of tracking information, or nil for none. 54 | */ 55 | - (void)send:(NSDictionary *)parameters; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/VERSION_3_13: -------------------------------------------------------------------------------- 1 | 3.13 2 | -------------------------------------------------------------------------------- /source/Plugins/iOS-nobitcode/libGoogleAnalyticsServices.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleanalytics/google-analytics-plugin-for-unity/865fbdfd8c43f6b4a724af74b9d80b5115e296e3/source/Plugins/iOS-nobitcode/libGoogleAnalyticsServices.a --------------------------------------------------------------------------------