smartlook
This commit is contained in:
6
Assets/Smartlook/SmartlookAnalytics/Scripts/README.md
Executable file
6
Assets/Smartlook/SmartlookAnalytics/Scripts/README.md
Executable file
@@ -0,0 +1,6 @@
|
||||
# Unity SDK bridge
|
||||
|
||||
Single source of truth for Unity C# bridge
|
||||
|
||||
## Report a issue
|
||||
If you want to **submit new issue** please use [smartlook-mobile-issue-tracker](https://github.com/smartlook/smartlook-mobile-issue-tracker).
|
||||
7
Assets/Smartlook/SmartlookAnalytics/Scripts/README.md.meta
Executable file
7
Assets/Smartlook/SmartlookAnalytics/Scripts/README.md.meta
Executable file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dd0436bfcddcb04787b932eb0ac8365
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/Smartlook/SmartlookAnalytics/Scripts/Settings.cs
Executable file
25
Assets/Smartlook/SmartlookAnalytics/Scripts/Settings.cs
Executable file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmartlookUnity
|
||||
{
|
||||
public class Settings : ScriptableObject
|
||||
{
|
||||
public const string SettingsResourceName = "SmartlookSettings";
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("Project Key")]
|
||||
public string ProjectKey;
|
||||
[SerializeField]
|
||||
[Tooltip("Frames per second")]
|
||||
[Range(1, 30)]
|
||||
public int FPS = 2;
|
||||
|
||||
private static Settings _instance;
|
||||
public static Settings Instance => _instance ??= LoadSettings();
|
||||
|
||||
public static Settings LoadSettings()
|
||||
{
|
||||
return Resources.Load(SettingsResourceName) as Settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Smartlook/SmartlookAnalytics/Scripts/Settings.cs.meta
Executable file
3
Assets/Smartlook/SmartlookAnalytics/Scripts/Settings.cs.meta
Executable file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a037d972e344070808470b09a6f9228
|
||||
timeCreated: 1680461368
|
||||
272
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.Android.cs
Executable file
272
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.Android.cs
Executable file
@@ -0,0 +1,272 @@
|
||||
#if UNITY_ANDROID
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmartlookUnity
|
||||
{
|
||||
public partial class Smartlook
|
||||
{
|
||||
static AndroidJavaClass SL;
|
||||
|
||||
static AndroidJavaClass getSLClass()
|
||||
{
|
||||
if (SL == null) SL = new AndroidJavaClass("com.smartlook.sdk.smartlook.Smartlook");
|
||||
return SL;
|
||||
}
|
||||
|
||||
static partial void SetupAndStartRecordingInternal(string key)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setupAndStartRecording", key);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetupAndStartRecordingInternal(string key, int frameRate)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setupAndStartRecording", key, frameRate);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetupAndStartRecordingInternal(SetupOptions setupOptions)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setupAndStartRecordingBridge", JsonUtility.ToJson(setupOptions));
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetupInternal(string key)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setup", key);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetupInternal(string key, int frameRate)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setup", key, frameRate);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetupInternal(SetupOptions setupOptions)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setupBridge", JsonUtility.ToJson(setupOptions));
|
||||
}
|
||||
}
|
||||
|
||||
static partial void StartFullscreenSensitiveModeInternal()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("startFullscreenSensitiveMode");
|
||||
}
|
||||
}
|
||||
|
||||
static partial void StopFullscreenSensitiveModeInternal()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("stopFullscreenSensitiveMode");
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetReferrerInternal(string referrer, string source)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setReferrer", referrer, source);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void TrackCustomEventInternal(string eventName)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("trackCustomEvent", eventName);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void TrackCustomEventInternal(string eventName, string properties)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("trackCustomEvent", eventName, properties);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void TrackNavigationEventInternal(string screenName, int direction)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
string internalDirection = "start";
|
||||
|
||||
if (direction.Equals(NavigationEventType.exit))
|
||||
{
|
||||
internalDirection = "stop";
|
||||
}
|
||||
|
||||
getSLClass().CallStatic("trackNavigationEvent", screenName, internalDirection);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void StopTimedCustomEventInternal(string eventId)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("stopTimedCustomEvent", eventId);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void StopTimedCustomEventInternal(string eventId, string properties)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("stopTimedCustomEvent", eventId, properties);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void CancelTimedCustomEventInternal(string eventId, string reason)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("cancelTimedCustomEvent", eventId, reason);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void CancelTimedCustomEventInternal(string eventId, string reason, string properties)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("cancelTimedCustomEvent", eventId, reason, properties);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetGlobalEventPropertyInternal(string eventName, string eventValue, bool immutable)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setGlobalEventProperty", eventName, eventValue, immutable);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetGlobalEventPropertiesInternal(string properties, bool immutable)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setGlobalEventProperties", properties, immutable);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void RemoveGlobalEventPropertyInternal(string eventName)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("removeGlobalEventProperty", eventName);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void RemoveAllGlobalEventPropertiesInternal()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("removeAllGlobalEventProperties");
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetUserIdentifierInternal(string userIdentifier)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setUserIdentifier", userIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetUserIdentifierInternal(string userIdentifier, string properties)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setUserIdentifier", userIdentifier);
|
||||
getSLClass().CallStatic("setUserProperties", properties, false);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void StartRecordingInternal()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("startRecording");
|
||||
}
|
||||
}
|
||||
|
||||
static partial void StopRecordingInternal()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("stopRecording");
|
||||
}
|
||||
}
|
||||
|
||||
static partial void EnableCrashlyticsInternal(bool enable)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("enableCrashlytics", enable);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void ResetSessionInternal(bool resetUser)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("resetSession", resetUser);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetRenderingModeInternal(int renderingMode)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
string internalRenderingMode = "native";
|
||||
|
||||
if (renderingMode.Equals(RenderingModeType.no_rendering))
|
||||
{
|
||||
internalRenderingMode = "no_rendering";
|
||||
}
|
||||
|
||||
getSLClass().CallStatic("setRenderingMode", internalRenderingMode);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetEventTrackingModeInternal(string eventTrackingMode)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setEventTrackingMode", eventTrackingMode);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void SetEventTrackingModesInternal(string eventTrackingModes)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("setEventTrackingModes", eventTrackingModes);
|
||||
}
|
||||
}
|
||||
|
||||
static partial void UnregisterIntegrationListenerInternal()
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("unregisterIntegrationListener");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.Android.cs.meta
Executable file
11
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.Android.cs.meta
Executable file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 872537cb224545f4a8c43d836d6b598e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
368
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.IOS.cs
Executable file
368
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.IOS.cs
Executable file
@@ -0,0 +1,368 @@
|
||||
#if UNITY_IOS
|
||||
|
||||
namespace SmartlookUnity {
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using AOT;
|
||||
|
||||
public partial class Smartlook {
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetupAndStartRecording(string key);
|
||||
|
||||
static partial void SetupAndStartRecordingInternal(string key) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetupAndStartRecording(key);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetupAndStartRecordingWithFramerate(string key, int frameRate);
|
||||
|
||||
static partial void SetupAndStartRecordingInternal(string key, int frameRate) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetupAndStartRecordingWithFramerate(key, frameRate);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetupAndStartRecordingWithOptions(string setupOptions);
|
||||
|
||||
static partial void SetupAndStartRecordingInternal(SetupOptions setupOptions) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetupAndStartRecordingWithOptions(JsonUtility.ToJson(setupOptions));
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetup(string key);
|
||||
|
||||
static partial void SetupInternal(string key) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetup(key);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetupWithFramerate(string key, int frameRate);
|
||||
|
||||
static partial void SetupInternal(string key, int frameRate) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetupWithFramerate(key, frameRate);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetupWithOptions(string setupOptions);
|
||||
|
||||
static partial void SetupInternal(SetupOptions setupOptions) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetupWithOptions(JsonUtility.ToJson(setupOptions));
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookStartRecording();
|
||||
|
||||
static partial void StartRecordingInternal() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookStartRecording();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookStopRecording();
|
||||
|
||||
static partial void StopRecordingInternal() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookStopRecording();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookStartFullscreenSensitiveMode();
|
||||
|
||||
static partial void StartFullscreenSensitiveModeInternal() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookStartFullscreenSensitiveMode();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookStopFullscreenSensitiveMode();
|
||||
|
||||
static partial void StopFullscreenSensitiveModeInternal() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookStopFullscreenSensitiveMode();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetReferrer(string referrer, string source);
|
||||
|
||||
static partial void SetReferrerInternal(string referrer, string source) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetReferrer(referrer, source);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookTrackCustomEvent(string eventName);
|
||||
|
||||
static partial void TrackCustomEventInternal(string eventName) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookTrackCustomEvent(eventName);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookTrackCustomEventWithProperties(string eventName, string properties);
|
||||
|
||||
static partial void TrackCustomEventInternal(string eventName, string properties) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookTrackCustomEventWithProperties(eventName, properties);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookTrackNavigationEvent(string screenName, int direction);
|
||||
|
||||
static partial void TrackNavigationEventInternal(string screenName, int direction) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookTrackNavigationEvent(screenName, direction);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetUserIdentifier(string userIdentifier);
|
||||
|
||||
static partial void SetUserIdentifierInternal(string userIdentifier) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetUserIdentifier(userIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetUserIdentifierWithProperties(string userIdentifier, string properties);
|
||||
|
||||
static partial void SetUserIdentifierInternal(string userIdentifier, string properties) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetUserIdentifierWithProperties(userIdentifier, properties);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern bool SmartlookIsRecording();
|
||||
|
||||
public static bool IsRecordingInternalIOS() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return SmartlookIsRecording();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern string SmartlookGetDashboardSessionUrl(bool withTimestamp);
|
||||
|
||||
public static string GetDashboardSessionUrlInternalIOS(bool withTimestamp) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return SmartlookGetDashboardSessionUrl(withTimestamp);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern string SmartlookGetDashboardVisitorUrl();
|
||||
|
||||
public static string GetDashboardVisitorUrlInternalIOS() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return SmartlookGetDashboardVisitorUrl();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookEnableCrashlytics(bool enable);
|
||||
|
||||
static partial void EnableCrashlyticsInternal(bool enable) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookEnableCrashlytics(enable);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern string SmartlookStartTimedCustomEvent(string eventName);
|
||||
|
||||
public static string StartTimedCustomEventInternalIOS(string eventName) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return SmartlookStartTimedCustomEvent(eventName);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern string SmartlookStartTimedCustomEventWithProperties(string eventName, string properties);
|
||||
|
||||
public static string StartTimedCustomEventInternalIOS(string eventName, string properties) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return SmartlookStartTimedCustomEventWithProperties(eventName, properties);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookStopTimedCustomEvent(string eventId);
|
||||
|
||||
static partial void StopTimedCustomEventInternal(string eventId) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookStopTimedCustomEvent(eventId);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookStopTimedCustomEventWithProperties(string eventId, string properties);
|
||||
|
||||
static partial void StopTimedCustomEventInternal(string eventId, string properties) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookStopTimedCustomEventWithProperties(eventId, properties);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookCancelTimedCustomEvent(string eventId, string reason);
|
||||
|
||||
static partial void CancelTimedCustomEventInternal(string eventId, string reason) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookCancelTimedCustomEvent(eventId, reason);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookCancelTimedCustomEventWithProperties(string eventId, string reason, string properties);
|
||||
|
||||
static partial void CancelTimedCustomEventInternal(string eventId, string reason, string properties) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookCancelTimedCustomEventWithProperties(eventId, reason, properties);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetGlobalEventProperty(string key, string value, bool immutable);
|
||||
|
||||
static partial void SetGlobalEventPropertyInternal(string key, string value, bool immutable) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetGlobalEventProperty(key, value, immutable);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetGlobalEventProperties(string properties, bool immutable);
|
||||
|
||||
static partial void SetGlobalEventPropertiesInternal(string properties, bool immutable) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetGlobalEventProperties(properties, immutable);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookRemoveGlobalEventProperty(string key);
|
||||
|
||||
static partial void RemoveGlobalEventPropertyInternal(string key) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookRemoveGlobalEventProperty(key);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookRemoveAllGlobalEventProperties();
|
||||
|
||||
static partial void RemoveAllGlobalEventPropertiesInternal() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookRemoveAllGlobalEventProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookResetSession(bool resetUser);
|
||||
|
||||
static partial void ResetSessionInternal(bool resetUser) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookResetSession(resetUser);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetRenderingMode(int renderingMode);
|
||||
|
||||
static partial void SetRenderingModeInternal(int renderingMode) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetRenderingMode(renderingMode);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetEventTrackingMode(string eventTrackingMode);
|
||||
|
||||
static partial void SetEventTrackingModeInternal(string eventTrackingMode)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetEventTrackingMode(eventTrackingMode);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetEventTrackingModes(string eventTrackingModes);
|
||||
|
||||
static partial void SetEventTrackingModesInternal(string eventTrackingModes)
|
||||
{
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookSetEventTrackingModes(eventTrackingModes);
|
||||
}
|
||||
}
|
||||
|
||||
private static IntegrationListener privateIntegrationListener;
|
||||
private delegate void DelegateMessage(string message);
|
||||
|
||||
[MonoPInvokeCallback(typeof(DelegateMessage))]
|
||||
private static void delegateVisitorUrlChanged(string message) {
|
||||
privateIntegrationListener.onVisitorReady(message);
|
||||
}
|
||||
|
||||
[MonoPInvokeCallback(typeof(DelegateMessage))]
|
||||
private static void delegateSessionUrlChanged(string message) {
|
||||
privateIntegrationListener.onSessionReady(message);
|
||||
}
|
||||
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetDashboardSessionUrlListener(DelegateMessage callback);
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookSetDashboardVisitorUrlListener(DelegateMessage callback);
|
||||
|
||||
public static void RegisterIntegrationListenerInternalIOS(IntegrationListener integrationListener) {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
privateIntegrationListener = integrationListener;
|
||||
|
||||
SmartlookSetDashboardSessionUrlListener(delegateSessionUrlChanged);
|
||||
SmartlookSetDashboardVisitorUrlListener(delegateVisitorUrlChanged);
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
static extern void SmartlookUnregisterDashboardListener();
|
||||
|
||||
static partial void UnregisterIntegrationListenerInternal() {
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
SmartlookUnregisterDashboardListener();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
11
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.IOS.cs.meta
Executable file
11
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.IOS.cs.meta
Executable file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cdf78a5d29fed94cafc9ebf39eec979
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
471
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.cs
Executable file
471
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.cs
Executable file
@@ -0,0 +1,471 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SmartlookUnity
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID
|
||||
/// Extended class can be passed to RegisterIntegrationListener method
|
||||
[SL_COMPATIBILITY_NAME("name=IntegrationListener;type=callback;members=onSessionReady,onVisitorReady")]
|
||||
public abstract class IntegrationListener : AndroidJavaProxy
|
||||
{
|
||||
public IntegrationListener() : base("com.smartlook.sdk.smartlook.integration.IntegrationListener") { }
|
||||
|
||||
public abstract void onSessionReady(string dashboardSessionUrl);
|
||||
public abstract void onVisitorReady(string dashboardVisitorUrl);
|
||||
}
|
||||
#elif UNITY_IOS
|
||||
/// Extended class can be passed to RegisterIntegrationListener method
|
||||
public abstract class IntegrationListener
|
||||
{
|
||||
public abstract void onSessionReady(string dashboardSessionUrl);
|
||||
public abstract void onVisitorReady(string dashboardVisitorUrl);
|
||||
}
|
||||
#else
|
||||
public abstract class IntegrationListener
|
||||
{
|
||||
public abstract void onSessionReady(string dashboardSessionUrl);
|
||||
public abstract void onVisitorReady(string dashboardVisitorUrl);
|
||||
}
|
||||
#endif
|
||||
|
||||
[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple = true)]
|
||||
public class SL_COMPATIBILITY_NAME : System.Attribute
|
||||
{
|
||||
private string value;
|
||||
|
||||
public SL_COMPATIBILITY_NAME(string value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public class SetupOptionsBuilder
|
||||
{
|
||||
protected string ApiKey { get; set; }
|
||||
protected int Fps { get; set; }
|
||||
protected bool StartNewSession { get; set; } = false;
|
||||
protected bool StartNewSessionAndUser { get; set; } = false;
|
||||
|
||||
public SetupOptionsBuilder(string ApiKey)
|
||||
{
|
||||
this.ApiKey = ApiKey;
|
||||
}
|
||||
|
||||
public SetupOptionsBuilder SetFps(int Fps)
|
||||
{
|
||||
this.Fps = Fps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SetupOptionsBuilder SetStartNewSession(bool StartNewSession)
|
||||
{
|
||||
this.StartNewSession = StartNewSession;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SetupOptionsBuilder SetStartNewSessionAndUser(bool StartNewSessionAndUser)
|
||||
{
|
||||
this.StartNewSessionAndUser = StartNewSessionAndUser;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SetupOptions Build()
|
||||
{
|
||||
return new SetupOptions(ApiKey, Fps, StartNewSession, StartNewSessionAndUser);
|
||||
}
|
||||
}
|
||||
|
||||
/// Setup options used in SetupAndStartRecording(SetupOptions setupOptions)
|
||||
[SL_COMPATIBILITY_NAME("name=SetupOptions;type=builder;members=smartlookAPIKey,fps,startNewSession,startNewSessionAndUser")]
|
||||
public class SetupOptions
|
||||
{
|
||||
public string ApiKey;
|
||||
public int Fps;
|
||||
public bool StartNewSession;
|
||||
public bool StartNewSessionAndUser;
|
||||
|
||||
public SetupOptions(string ApiKey, int Fps, bool StartNewSession, bool StartNewSessionAndUser)
|
||||
{
|
||||
this.ApiKey = ApiKey;
|
||||
this.Fps = Fps;
|
||||
this.StartNewSession = StartNewSession;
|
||||
this.StartNewSessionAndUser = StartNewSessionAndUser;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static partial class Smartlook
|
||||
{
|
||||
public enum NavigationEventType { enter = 0, exit = 1 }
|
||||
public enum RenderingModeType { native = 0, no_rendering = 1 }
|
||||
[Serializable]
|
||||
public enum EventTrackingMode { FULL_TRACKING, IGNORE_USER_INTERACTION, IGNORE_NAVIGATION_INTERACTION, IGNORE_RAGE_CLICKS, NO_TRACKING }
|
||||
|
||||
[Serializable]
|
||||
public class TrackingEventsWrapper
|
||||
{
|
||||
public List<string> eventTrackingModes;
|
||||
}
|
||||
|
||||
/// Setup Smartlook and start recording.
|
||||
/// <param name="key">The application (project) specific SDK key, available in your Smartlook dashboard.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setupAndStartRecording;type=func;params=smartlookAPIKey{string}")]
|
||||
public static void SetupAndStartRecording(string key) { SetupAndStartRecordingInternal(key); }
|
||||
|
||||
/// Setup Smartlook and start recording, with custom framerate.
|
||||
/// <param name="key">The application (project) specific SDK key, available in your Smartlook dashboard.</param>
|
||||
/// <param name="frameRate">Custom recording framerate.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setupAndStartRecording;type=func;params=smartlookAPIKey{string},fps{int};deprecated=yes")]
|
||||
public static void SetupAndStartRecording(string key, int frameRate) { SetupAndStartRecordingInternal(key, frameRate); }
|
||||
|
||||
/// Setup Smartlook and start recording with custom setup options.
|
||||
/// <param name="setupOptions">Instance of SetupOptions class.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setupAndStartRecording;type=func;params=setupOptions{SetupOptions}")]
|
||||
public static void SetupAndStartRecording(SetupOptions setupOptions) { SetupAndStartRecordingInternal(setupOptions); }
|
||||
|
||||
/// Setup Smartlook. This method initializes Smartlook SDK, but does not start recording. To start recording, call StartRecording() method.
|
||||
/// <param name="key">The application (project) specific SDK key, available in your Smartlook dashboard.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setup;type=func;params=smartlookAPIKey{string}")]
|
||||
public static void Setup(string key) { SetupInternal(key); }
|
||||
|
||||
/// Setup Smartlook. This method initializes Smartlook SDK, but does not start recording. To start recording, call StartRecording() method.
|
||||
/// <param name="key">The application (project) specific SDK key, available in your Smartlook dashboard.</param>
|
||||
/// <param name="frameRate">Custom recording framerate.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setup;type=func;params=smartlookAPIKey{string},fps{int};deprecated=yes")]
|
||||
public static void Setup(string key, int frameRate) { SetupInternal(key, frameRate); }
|
||||
|
||||
/// Setup Smartlook. This method initializes Smartlook SDK, but does not start recording. To start recording, call StartRecording() method.
|
||||
/// <param name="setupOptions">Instance of SetupOptions class.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setup;type=func;params=setupOptions{SetupOptions}")]
|
||||
public static void Setup(SetupOptions setupOptions) { SetupInternal(setupOptions); }
|
||||
|
||||
/// Starts video and events recording.
|
||||
[SL_COMPATIBILITY_NAME("name=startRecording;type=func")]
|
||||
public static void StartRecording() { StartRecordingInternal(); }
|
||||
|
||||
/// Stops video and events recording.
|
||||
[SL_COMPATIBILITY_NAME("name=stopRecording;type=func")]
|
||||
public static void StopRecording() { StopRecordingInternal(); }
|
||||
|
||||
/// Current video and events recording state.
|
||||
[SL_COMPATIBILITY_NAME("name=isRecording;type=func;returns=boolean")]
|
||||
public static bool IsRecording() { return IsRecordingInternal(); }
|
||||
|
||||
/// <summary>
|
||||
/// Start timer for custom event.
|
||||
/// This method does not record an event. It is the subsequent `RecordEvent` call with the same `eventId` that does.
|
||||
/// In the resulting event, the property dictionaries of `start` and `record` are merged (the `record` values override the `start` ones if the key is the same), and a `duration` property is added to them.
|
||||
/// <summary>
|
||||
/// <param name="eventName">Name of the event.</param>
|
||||
/// <param name="properties">Optional dictionary (json string, obtained for example with JsonUtility.ToJson(param)) with additional information. Non String values will be stringlified.</param>
|
||||
/// <returns>
|
||||
/// eventId that can be used in StopTimedCustomEvent or CancelTimedCustomEvent methods
|
||||
/// </returns>
|
||||
[SL_COMPATIBILITY_NAME("name=startTimedCustomEvent;type=func;params=eventName{string},eventProperties{JSONObject};returns=string")]
|
||||
[SL_COMPATIBILITY_NAME("name=startTimedCustomEvent;type=func;params=eventName{string},bundle{Bundle};returns=string")]
|
||||
[SL_COMPATIBILITY_NAME("name=startTimedCustomEvent;type=func;params=eventName{string},eventProperties{string};returns=string")]
|
||||
public static string StartTimedCustomEvent(string eventName, string properties) { return StartTimedCustomEventInternal(eventName, properties); }
|
||||
|
||||
/// <summary>
|
||||
/// Start timer for custom event.
|
||||
/// This method does not record an event. It is the subsequent `RecordEvent` call with the same `eventId` that does.
|
||||
/// In the resulting event, the property dictionaries of `start` and `record` are merged (the `record` values override the `start` ones if the key is the same), and a `duration` property is added to them.
|
||||
/// <summary>
|
||||
/// <param name="eventName">Name of the event.</param>
|
||||
/// <returns>
|
||||
/// eventId that can be used in StopTimedCustomEvent or CancelTimedCustomEvent methods
|
||||
/// </returns>
|
||||
/// <param name="eventName">Name of the event.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=startTimedCustomEvent;type=func;params=eventName{string};returns=string")]
|
||||
public static string StartTimedCustomEvent(string eventName) { return StartTimedCustomEventInternal(eventName); }
|
||||
|
||||
/// Stops timed event
|
||||
/// <param name="eventId">Name of the event.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=stopTimedCustomEvent;type=func;params=eventId{string}")]
|
||||
public static void StopTimedCustomEvent(string eventId) { StopTimedCustomEventInternal(eventId); }
|
||||
|
||||
/// Stops timed event
|
||||
/// <param name="eventId">Name of the event.</param>
|
||||
/// <param name="properties">Optional dictionary (json string, obtained for example with JsonUtility.ToJson(param)) with additional information. Non String values will be stringlified.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=stopTimedCustomEvent;type=func;params=eventId{string},eventProperties{JSONObject}")]
|
||||
[SL_COMPATIBILITY_NAME("name=stopTimedCustomEvent;type=func;params=eventId{string},bundle{Bundle}")]
|
||||
[SL_COMPATIBILITY_NAME("name=stopTimedCustomEvent;type=func;params=eventId{string},eventProperties{string}")]
|
||||
public static void StopTimedCustomEvent(string eventId, string properties) { StopTimedCustomEventInternal(eventId, properties); }
|
||||
|
||||
/// Cancels timed event
|
||||
/// <param name="eventId">Name of the event.</param>
|
||||
/// <param name="reason">Cancellation Reason</param>
|
||||
[SL_COMPATIBILITY_NAME("name=cancelTimedCustomEvent;type=func;params=eventId{string},reason{string}")]
|
||||
public static void CancelTimedCustomEvent(string eventId, string reason) { CancelTimedCustomEventInternal(eventId, reason); }
|
||||
|
||||
/// <param name="eventId">Name of the event.</param>
|
||||
/// <param name="reason">Cancellation Reason</param>
|
||||
/// <param name="properties">Optional dictionary (json string, obtained for example with JsonUtility.ToJson(param)) with additional information. Non String values will be stringlified.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=cancelTimedCustomEvent;type=func;params=eventId{string},reason{string},eventProperties{JSONObject}")]
|
||||
[SL_COMPATIBILITY_NAME("name=cancelTimedCustomEvent;type=func;params=eventId{string},reason{string},bundle{Bundle}")]
|
||||
[SL_COMPATIBILITY_NAME("name=cancelTimedCustomEvent;type=func;params=eventId{string},reason{string},eventProperties{string}")]
|
||||
public static void CancelTimedCustomEvent(string eventId, string reason, string properties) { CancelTimedCustomEventInternal(eventId, reason, properties); }
|
||||
|
||||
/// Records timestamped custom event.
|
||||
/// <param name="eventName">Name that identifies the event.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=trackCustomEvent;type=func;params=eventName{string}")]
|
||||
public static void TrackCustomEvent(string eventName) { TrackCustomEventInternal(eventName); }
|
||||
|
||||
/// Records timestamped custom event with optional properties.
|
||||
/// <param name="eventName">Name that identifies the event.</param>
|
||||
/// <param name="properties">Optional dictionary (json string, obtained for example with JsonUtility.ToJson(param)) with additional information. Non String values will be stringlified.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=trackCustomEvent;type=func;params=eventName{string},eventProperties{JSONObject}")]
|
||||
[SL_COMPATIBILITY_NAME("name=trackCustomEvent;type=func;params=eventName{string},bundle{Bundle}")]
|
||||
[SL_COMPATIBILITY_NAME("name=trackCustomEvent;type=func;params=eventName{string},properties{string}")]
|
||||
public static void TrackCustomEvent(string eventName, string properties) { TrackCustomEventInternal(eventName, properties); }
|
||||
|
||||
/// Records navigation event
|
||||
/// <param name="screenName">Name that identifies the screen user is currently on.</param>
|
||||
/// <param name="direction">Navigation direction. Either entering the screen, or exiting the screen.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=trackNavigationEvent;type=func;params=name{string},viewState{ViewState}")]
|
||||
public static void TrackNavigationEvent(string screenName, NavigationEventType direction) { TrackNavigationEventInternal(screenName, (int)direction); }
|
||||
|
||||
/// Global event properties are sent with every event.
|
||||
/// <param name="key">Property key (name).</param>
|
||||
/// <param name="value">Property Value.</param>
|
||||
/// <param name="immutable">To change immutable property, you need to remove that property first.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setGlobalEventProperty;type=func;params=key{string},value{string},immutable{boolean}")]
|
||||
public static void SetGlobalEventProperty(string key, string value, bool immutable) { SetGlobalEventPropertyInternal(key, value, immutable); }
|
||||
|
||||
/// Global event properties are sent with every event.
|
||||
/// <param name="properties">Optional dictionary (json string, obtained for example with JsonUtility.ToJson(param)) with additional information. Non String values will be stringlified.</param>
|
||||
/// <param name="immutable">To change immutable property, you need to remove that property first.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setGlobalEventProperties;type=func;params=globalEventProperties{JSONObject},immutable{boolean}")]
|
||||
[SL_COMPATIBILITY_NAME("name=setGlobalEventProperties;type=func;params=globalEventProperties{Bundle},immutable{boolean}")]
|
||||
[SL_COMPATIBILITY_NAME("name=setGlobalEventProperties;type=func;params=globalEventProperties{string},immutable{boolean}")]
|
||||
public static void SetGlobalEventProperties(string properties, bool immutable) { SetGlobalEventPropertiesInternal(properties, immutable); }
|
||||
|
||||
/// Removes global event property
|
||||
[SL_COMPATIBILITY_NAME("name=removeGlobalEventProperty;type=func;params=key{string}")]
|
||||
public static void RemoveGlobalEventProperty(string key) { RemoveGlobalEventPropertyInternal(key); }
|
||||
|
||||
/// Removes all global event properties
|
||||
[SL_COMPATIBILITY_NAME("name=removeAllGlobalEventProperties;type=func")]
|
||||
public static void RemoveAllGlobalEventProperties() { RemoveAllGlobalEventPropertiesInternal(); }
|
||||
|
||||
/// Returns URL leading to the Dashboard player for the current Smartlook session. This URL can be access by everyone with the access rights to the dashboard.
|
||||
/// <param name="withCurrentTimestamp">If true recording starts at current time</param>
|
||||
[SL_COMPATIBILITY_NAME("name=getDashboardSessionUrl;type=func;params=withCurrentTimestamp{boolean};returns=string")]
|
||||
public static string GetDashboardSessionUrl(bool withCurrentTimestamp) { return GetDashboardSessionUrlInternal(withCurrentTimestamp); }
|
||||
|
||||
/// Returns URL leading to the Dashboard for current visitor. This URL can be access by everyone with the access rights to the dashboard.
|
||||
[SL_COMPATIBILITY_NAME("name=getDashboardVisitorUrl;type=func;returns=string")]
|
||||
public static string GetDashboardVisitorUrl() { return GetDashboardVisitorUrlInternal(); }
|
||||
|
||||
/// Use this method to enter the **full sensitive mode**. No video is recorded, just analytics events.
|
||||
[SL_COMPATIBILITY_NAME("name=startFullscreenSensitiveMode;type=func;deprecated=yes")]
|
||||
public static void StartFullscreenSensitiveMode() { StartFullscreenSensitiveModeInternal(); }
|
||||
|
||||
/// Use this method to leave the **full sensitive mode**. Video is recorded again.
|
||||
[SL_COMPATIBILITY_NAME("name=stopFullscreenSensitiveMode;type=func;deprecated=yes")]
|
||||
public static void StopFullscreenSensitiveMode() { StopFullscreenSensitiveModeInternal(); }
|
||||
|
||||
[SL_COMPATIBILITY_NAME("name=setReferrer;type=func;params=referrer{string},source{string}")]
|
||||
public static void SetReferrer(string referrer, string source) { SetReferrerInternal(referrer, source); }
|
||||
|
||||
/// Enables/disabled Crashlytics integration
|
||||
[SL_COMPATIBILITY_NAME("name=enableCrashlytics;type=func;params=enable{boolean}")]
|
||||
public static void EnableCrashlytics(bool enable) { EnableCrashlyticsInternal(enable); }
|
||||
|
||||
/// Resets the current session by implicitly starting a new session. Optionally, it also resets the user.
|
||||
/// <param name="resetUser">Indicates whether new session starts with new user.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=resetSession;type=func;params=resetUser{boolean}")]
|
||||
public static void ResetSession(bool resetUser) { ResetSessionInternal(resetUser); }
|
||||
|
||||
/// By changing rendering mode you can adjust the way we render the application for recordings.
|
||||
/// <param name="renderingMode">Options are RenderingModeType.native (normal recording), and RenderingModeType.no_rendering (gray screen).</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setRenderingMode;type=func;params=renderingMode{RenderingMode}")]
|
||||
public static void SetRenderingMode(RenderingModeType renderingMode) { SetRenderingModeInternal((int)renderingMode); }
|
||||
|
||||
/// By changing rendering mode you can adjust the way we render the application for recordings.
|
||||
/// <param name="eventTrackingMode">Desired tracking mode.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setEventTrackingMode;type=func;params=eventTrackingMode{EventTrackingMode}")]
|
||||
public static void setEventTrackingMode(EventTrackingMode eventTrackingMode) { SetEventTrackingModeInternal(eventTrackingMode.ToString()); }
|
||||
|
||||
/// By changing rendering mode you can adjust the way we render the application for recordings.
|
||||
/// <param name="eventTrackingModes">Desired tracking modes.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setEventTrackingModes;type=func;params=eventTrackingModes{List[EventTrackingMode]}")]
|
||||
public static void setEventTrackingModes(List<EventTrackingMode> eventTrackingModes) { SetEventTrackingModesInternal(handleEventModes(eventTrackingModes)); }
|
||||
|
||||
private static string handleEventModes(List<EventTrackingMode> modes)
|
||||
{
|
||||
SmartlookUnity.Smartlook.TrackingEventsWrapper wrapper = new SmartlookUnity.Smartlook.TrackingEventsWrapper() { eventTrackingModes = modes.ConvertAll(mode => mode.ToString()) };
|
||||
string input = JsonUtility.ToJson(wrapper);
|
||||
string array = "[" + input.Split('[')[1].Split(']')[0] + "]";
|
||||
return array;
|
||||
}
|
||||
|
||||
/// Set the app's user identifier.
|
||||
/// <param name="userIdentifier">The application-specific user identifier.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setUserIdentifier;type=func;params=identifier{string}")]
|
||||
public static void SetUserIdentifier(string userIdentifier) { SetUserIdentifierInternal(userIdentifier); }
|
||||
|
||||
/// Set the app's user identifier with additional properties.
|
||||
/// <param name="userIdentifier">The application-specific user identifier.</param>
|
||||
/// <param name="properties">Optional dictionary (json string, obtained for example with JsonUtility.ToJson(param)) with additional information. Non String values will be stringlified.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=setUserProperties;type=func;params=sessionProperties{JSONObject},immutable{boolean}")]
|
||||
[SL_COMPATIBILITY_NAME("name=setUserProperties;type=func;params=sessionProperties{Bundle},immutable{boolean}")]
|
||||
[SL_COMPATIBILITY_NAME("name=setUserProperties;type=func;params=sessionProperties{string},immutable{boolean}")]
|
||||
public static void SetUserIdentifier(string userIdentifier, string properties) { SetUserIdentifierInternal(userIdentifier, properties); }
|
||||
|
||||
/// Set integration listener
|
||||
/// <param name="integrationListener">You provide your own subclass of IntegrationListener, with onSessionReady() and onVisitorReady callbacks, which are called when dashboard visitor url or dashboard session url changes.</param>
|
||||
[SL_COMPATIBILITY_NAME("name=registerIntegrationListener;type=func;params=integrationListener{IntegrationListener}")]
|
||||
public static void RegisterIntegrationListener(IntegrationListener integrationListener) { RegisterIntegrationListenerInternal(integrationListener); }
|
||||
|
||||
/// Unregister integration listener
|
||||
[SL_COMPATIBILITY_NAME("name=unregisterIntegrationListener;type=func")]
|
||||
public static void UnregisterIntegrationListener() { UnregisterIntegrationListenerInternal(); }
|
||||
|
||||
public static void EnableLogging()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("enableLogging", "[ALL]");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Internal
|
||||
static partial void SetupAndStartRecordingInternal(string key);
|
||||
static partial void SetupAndStartRecordingInternal(string key, int frameRate);
|
||||
static partial void SetupAndStartRecordingInternal(SetupOptions setupOptions);
|
||||
static partial void SetupInternal(string key);
|
||||
static partial void SetupInternal(string key, int frameRate);
|
||||
static partial void SetupInternal(SetupOptions setupOptions);
|
||||
static partial void StartRecordingInternal();
|
||||
static partial void StopRecordingInternal();
|
||||
static partial void TrackCustomEventInternal(string eventName);
|
||||
static partial void TrackCustomEventInternal(string eventName, string properties);
|
||||
static partial void TrackNavigationEventInternal(string screenName, int direction);
|
||||
static partial void SetGlobalEventPropertyInternal(string key, string value, bool immutable);
|
||||
static partial void SetGlobalEventPropertiesInternal(string properties, bool immutable);
|
||||
static partial void RemoveGlobalEventPropertyInternal(string key);
|
||||
static partial void RemoveAllGlobalEventPropertiesInternal();
|
||||
static partial void StartFullscreenSensitiveModeInternal();
|
||||
static partial void StopFullscreenSensitiveModeInternal();
|
||||
static partial void SetReferrerInternal(string referrer, string source);
|
||||
static partial void EnableCrashlyticsInternal(bool enable);
|
||||
static partial void SetUserIdentifierInternal(string userIdentifier);
|
||||
static partial void SetUserIdentifierInternal(string userIdentifier, string properties);
|
||||
static partial void StopTimedCustomEventInternal(string eventId);
|
||||
static partial void StopTimedCustomEventInternal(string eventId, string properties);
|
||||
static partial void CancelTimedCustomEventInternal(string eventId, string reason);
|
||||
static partial void CancelTimedCustomEventInternal(string eventId, string reason, string properties);
|
||||
static partial void ResetSessionInternal(bool resetUser);
|
||||
static partial void SetRenderingModeInternal(int renderingMode);
|
||||
static partial void SetEventTrackingModeInternal(string eventTrackingMode);
|
||||
static partial void SetEventTrackingModesInternal(string eventTrackingModes);
|
||||
static partial void UnregisterIntegrationListenerInternal();
|
||||
|
||||
|
||||
public static bool IsRecordingInternal()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return getSLClass().CallStatic<bool>("isRecording");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return IsRecordingInternalIOS();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string GetDashboardSessionUrlInternal(bool withCurrentTimestamp)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return getSLClass().CallStatic<string>("getDashboardSessionUrl", withCurrentTimestamp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return GetDashboardSessionUrlInternalIOS(withCurrentTimestamp);
|
||||
}
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string GetDashboardVisitorUrlInternal()
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return getSLClass().CallStatic<string>("getDashboardVisitorUrl");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return GetDashboardVisitorUrlInternalIOS();
|
||||
}
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string StartTimedCustomEventInternal(string eventName)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return getSLClass().CallStatic<string>("startTimedCustomEvent", eventName);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return StartTimedCustomEventInternalIOS(eventName);
|
||||
}
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string StartTimedCustomEventInternal(string eventName, string properties)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
return getSLClass().CallStatic<string>("startTimedCustomEvent", eventName, properties);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
return StartTimedCustomEventInternalIOS(eventName, properties);
|
||||
}
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
private static void RegisterIntegrationListenerInternal(IntegrationListener integrationListener)
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
if (Application.platform == RuntimePlatform.Android)
|
||||
{
|
||||
getSLClass().CallStatic("registerIntegrationListener", integrationListener);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_IOS
|
||||
if (Application.platform == RuntimePlatform.IPhonePlayer) {
|
||||
RegisterIntegrationListenerInternalIOS(integrationListener);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.cs.meta
Executable file
11
Assets/Smartlook/SmartlookAnalytics/Scripts/Smartlook.cs.meta
Executable file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c57b92e3c12c1744824630b3f25d4f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Assets/Smartlook/SmartlookAnalytics/Scripts/SmartlookInitializer.cs
Executable file
29
Assets/Smartlook/SmartlookAnalytics/Scripts/SmartlookInitializer.cs
Executable file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SmartlookUnity
|
||||
{
|
||||
[DefaultExecutionOrder(-5000)]
|
||||
public class SmartlookInitializer : MonoBehaviour
|
||||
{
|
||||
[Tooltip("Reset Session")]
|
||||
public bool ResetSession;
|
||||
[Tooltip("Reset User")]
|
||||
public bool ResetUser;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var settings = Settings.Instance;
|
||||
if (settings == null)
|
||||
{
|
||||
Debug.LogError("Smartlook: Settings file missing. Open menu \"Smartlook/Edit Settings\" and provide desired settings");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(settings.ProjectKey))
|
||||
{
|
||||
Debug.LogError("Smartlook: Project Key is missing. Open menu \"Smartlook/Edit Settings\" and provide correct Project Key.");
|
||||
return;
|
||||
}
|
||||
Smartlook.SetupAndStartRecording(new SetupOptions(settings.ProjectKey, settings.FPS, ResetSession, ResetUser));
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Smartlook/SmartlookAnalytics/Scripts/SmartlookInitializer.cs.meta
Executable file
3
Assets/Smartlook/SmartlookAnalytics/Scripts/SmartlookInitializer.cs.meta
Executable file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f8ef78bee04409481341d4213ba58aa
|
||||
timeCreated: 1680463181
|
||||
Reference in New Issue
Block a user