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.

91 lines
2.8KB

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