Class AnalyticsClient

java.lang.Object
com.vaadin.copilot.CopilotServerClient
com.vaadin.copilot.analytics.AnalyticsClient

public class AnalyticsClient extends CopilotServerClient
Client for tracking features of Copilot
  • Method Details

    • getInstance

      public static AnalyticsClient 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

      public void setUserContext(Map<String,String> userContext)
    • track

      public void track(String event, Map<String,String> properties)
      Track event to copilot-server
      Parameters:
      event - Event name
      properties - Map of event properties
    • sendRequest

      protected void sendRequest(String event, Map<String,String> properties, Map<String,String> context)