mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-29 17:16:57 -04:00
onboarding events
This commit is contained in:
parent
6b383dad34
commit
42a170687d
8 changed files with 67 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
extends Node
|
||||
class_name Analitycs
|
||||
class_name Analytics
|
||||
|
||||
signal analytics_ready
|
||||
|
||||
|
@ -12,6 +12,15 @@ func _ready() -> void:
|
|||
analytics_ready.emit()
|
||||
|
||||
|
||||
func send_event(body: Dictionary = {}) -> void:
|
||||
var url = api.analytics_event
|
||||
var callback = func(_result, code, _headers, _body):
|
||||
if code != 200: Debug.logclr("Request send_event failed. Code " + str(code), Color.RED)
|
||||
|
||||
var err = await Backend.request(url, callback, body, HTTPClient.METHOD_POST)
|
||||
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request send_event", Color.RED)
|
||||
|
||||
|
||||
func get_app_version() -> void:
|
||||
AnalyticsEvents.app_version = ProjectSettings.get_setting("application/config/version")
|
||||
|
||||
|
@ -32,10 +41,5 @@ func get_user_id() -> void:
|
|||
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request create_user_id", Color.RED)
|
||||
|
||||
|
||||
func send_event(body: Dictionary = {}) -> void:
|
||||
var url = api.analytics_event
|
||||
var callback = func(_result, code, _headers, _body):
|
||||
if code != 200: Debug.logclr("Request send_event failed. Code " + str(code), Color.RED)
|
||||
|
||||
var err = await Backend.request(url, callback, body, HTTPClient.METHOD_POST)
|
||||
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request send_event", Color.RED)
|
||||
static func get_delta_sec_from_tick(from_tick: int) -> float:
|
||||
return float(Time.get_ticks_msec() - from_tick) / 1000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue