Package com.vaadin.copilot.analytics
Class AnalyticsClient
java.lang.Object
com.vaadin.copilot.CopilotServerClient
com.vaadin.copilot.analytics.AnalyticsClient
Client for tracking features of Copilot
-
Field Summary
Fields inherited from class com.vaadin.copilot.CopilotServerClient
SERVER_URL_ENV -
Method Summary
Modifier and TypeMethodDescriptionstatic AnalyticsClientGet the singleton instance.booleanCheck if tracking is enabled.protected voidvoidsetEnabled(boolean enabled) Set whether tracking is enabled.voidsetUserContext(Map<String, String> userContext) voidTrack event to copilot-serverMethods inherited from class com.vaadin.copilot.CopilotServerClient
buildRequest, getHttpClient, getLogger, getQueryURI, getServerBaseUrl, readValue, sendReactive, writeAsJsonString
-
Method Details
-
getInstance
Get the singleton instance.- Returns:
- the singleton instance of the client, never null
-
setEnabled
public void setEnabled(boolean enabled) Set whether tracking is enabled.Should only ever called from
CopilotIndexHtmlLoader.- Parameters:
enabled- true if tracking should be enabled, false otherwise
-
isEnabled
public boolean isEnabled()Check if tracking is enabled.- Returns:
- true if tracking is enabled, false otherwise
-
setUserContext
-
track
Track event to copilot-server- Parameters:
event- Event nameproperties- Map of event properties
-
sendRequest
-