The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. //==============================================================================
  21. /**
  22. An interface for handling analytics events collected by an Analytics object.
  23. For basic analytics logging you can implement this interface and add your
  24. class to an Analytics object.
  25. For more advanced logging you may want to subclass
  26. ThreadedAnalyticsDestination instead, which is more suitable for interacting
  27. with web servers and other time consuming destinations.
  28. @see Analytics, ThreadedAnalyticsDestination
  29. @tags{Analytics}
  30. */
  31. struct JUCE_API AnalyticsDestination
  32. {
  33. /** Contains information about an event to be logged. */
  34. struct AnalyticsEvent
  35. {
  36. /** The name of the event. */
  37. String name;
  38. /** An optional integer representing the type of the event. You can use
  39. this to indicate if the event was a screenview, session start,
  40. exception, etc.
  41. */
  42. int eventType;
  43. /**
  44. The timestamp of the event.
  45. Timestamps are automatically applied by an Analytics object and are
  46. derived from Time::getMillisecondCounter(). As such these timestamps
  47. do not represent absolute times, but relative timings of events for
  48. each user in each session will be accurate.
  49. */
  50. uint32 timestamp;
  51. /** The parameters of the event. */
  52. StringPairArray parameters;
  53. /** The user ID associated with the event. */
  54. String userID;
  55. /** Properties associated with the user. */
  56. StringPairArray userProperties;
  57. };
  58. /** Constructor. */
  59. AnalyticsDestination() = default;
  60. /** Destructor. */
  61. virtual ~AnalyticsDestination() = default;
  62. /**
  63. When an AnalyticsDestination is added to an Analytics object this method
  64. is called when an analytics event is triggered from the Analytics
  65. object.
  66. Override this method to log the event information somewhere useful.
  67. */
  68. virtual void logEvent (const AnalyticsEvent& event) = 0;
  69. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AnalyticsDestination)
  70. };
  71. } // namespace juce