Created
September 8, 2020 20:01
-
-
Save marcusx2/bba221f3ca3d8177cf7ef17e4148f322 to your computer and use it in GitHub Desktop.
Google Analytics WebGL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//GoogleAnalytics.jslib | |
mergeInto(LibraryManager.library, { | |
sendGoogleAnalyticsEvent: function(hspt) { | |
gtag('event', 'Click', { | |
'event_category' : 'Hotspot', | |
'event_label' : Pointer_stringify(hspt) | |
}); | |
} | |
}); | |
//GoogleAnalytics.cs | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System.Runtime.InteropServices; | |
public class GoogleAnalytics : MonoBehaviour | |
{ | |
#if UNITY_WEBGL | |
[DllImport("__Internal")] | |
public static extern void sendGoogleAnalyticsEvent(string hotspot); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment