JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Analytics Class Reference

A singleton class to manage analytics data. More...

#include <juce_Analytics.h>

Inheritance diagram for juce::Analytics:
Collaboration diagram for juce::Analytics:

Public Member Functions

void addDestination (AnalyticsDestination *destination)
 Adds an AnalyticsDestination to the list of AnalyticsDestinations managed by this Analytics object. More...
 
OwnedArray< AnalyticsDestination > & getDestinations ()
 Returns the array of AnalyticsDestinations managed by this class. More...
 
void logEvent (const String &eventName, const StringPairArray &parameters, int eventType=0)
 Sends an AnalyticsEvent to all AnalyticsDestinations. More...
 
void setSuspended (bool shouldBeSuspended)
 Suspends analytics submissions to AnalyticsDestinations. More...
 
void setUserId (String newUserId)
 Sets a user ID that will be added to all AnalyticsEvents sent to AnalyticsDestinations. More...
 
void setUserProperties (StringPairArray properties)
 Sets some user properties that will be added to all AnalyticsEvents sent to AnalyticsDestinations. More...
 

Static Public Member Functions

static void deleteAll ()
 Deletes all extant objects. More...
 

Private Member Functions

 Analytics ()=default
 
 ~Analytics () override
 

Private Attributes

OwnedArray< AnalyticsDestinationdestinations
 
bool isSuspended = false
 
String userId
 
StringPairArray userProperties
 

Detailed Description

A singleton class to manage analytics data.

Use an Analytics object to manage sending analytics data to one or more AnalyticsDestinations.

See also
AnalyticsDestination, ThreadedAnalyticsDestination, AnalyticsDestination::AnalyticsEvent

@tags{Analytics}

Constructor & Destructor Documentation

◆ Analytics()

juce::Analytics::Analytics ( )
privatedefault

◆ ~Analytics()

juce::Analytics::~Analytics ( )
inlineoverrideprivate

Member Function Documentation

◆ addDestination()

void juce::Analytics::addDestination ( AnalyticsDestination destination)

Adds an AnalyticsDestination to the list of AnalyticsDestinations managed by this Analytics object.

The Analytics class will take ownership of the AnalyticsDestination passed to this function.

Parameters
destinationthe AnalyticsDestination to manage

◆ deleteAll()

static void juce::DeletedAtShutdown::deleteAll ( )
staticinherited

Deletes all extant objects.

This shouldn't be used by applications, as it's called automatically in the shutdown code of the JUCEApplicationBase class.

◆ getDestinations()

OwnedArray<AnalyticsDestination>& juce::Analytics::getDestinations ( )

Returns the array of AnalyticsDestinations managed by this class.

If you have added any subclasses of ThreadedAnalyticsDestination to this class then you can remove them from this list to force them to flush any pending events.

◆ logEvent()

void juce::Analytics::logEvent ( const String eventName,
const StringPairArray parameters,
int  eventType = 0 
)

Sends an AnalyticsEvent to all AnalyticsDestinations.

The AnalyticsEvent will be timestamped, and will have the userId and userProperties populated by values previously set by calls to setUserId and setUserProperties. The name, parameters and type will be populated by the arguments supplied to this function.

Parameters
eventNamethe event name
parametersthe event parameters
eventType(optional) an integer to indicate the event type, which will be set to 0 if not supplied.

◆ setSuspended()

void juce::Analytics::setSuspended ( bool  shouldBeSuspended)

Suspends analytics submissions to AnalyticsDestinations.

Parameters
shouldBeSuspendedif event submission should be suspended

◆ setUserId()

void juce::Analytics::setUserId ( String  newUserId)

Sets a user ID that will be added to all AnalyticsEvents sent to AnalyticsDestinations.

Parameters
newUserIdthe userId to add to AnalyticsEvents

◆ setUserProperties()

void juce::Analytics::setUserProperties ( StringPairArray  properties)

Sets some user properties that will be added to all AnalyticsEvents sent to AnalyticsDestinations.

Parameters
propertiesthe userProperties to add to AnalyticsEvents

Member Data Documentation

◆ destinations

OwnedArray<AnalyticsDestination> juce::Analytics::destinations
private

◆ isSuspended

bool juce::Analytics::isSuspended = false
private

◆ userId

String juce::Analytics::userId
private

◆ userProperties

StringPairArray juce::Analytics::userProperties
private

The documentation for this class was generated from the following file: