firebase::analytics::Parameter

#include <analytics.h>

Event parameter.

Summary

Parameters supply information that contextualize events (see LogEvent). You can associate up to 25 unique Parameters with each event type (name).

Common event types (names) are suggested in Analytics Events (event_names.h) with parameters of common event types defined in Analytics Parameters (parameter_names.h).

You are not limited to the set of event types and parameter names suggested in Analytics Events (event_names.h) and parameter_names.h respectively. Additional Parameters can be supplied for suggested event types or custom Parameters for custom event types.

Parameter names must be a combination of letters and digits (matching the regular expression [a-zA-Z0-9]) between 1 and 40 characters long starting with a letter [a-zA-Z] character. The "firebase_", "google_" and "ga_" prefixes are reserved and should not be used.

Parameter string values can be up to 100 characters long.

An array of this structure is passed to LogEvent in order to associate parameter's of an event (Parameter::name) with values (Parameter::value) where each value can be a double, 64-bit integer or string.

For example, a game may log an achievement event along with the character the player is using and the level they're currently on:

using namespace firebase::analytics;
int64_t current_level = GetCurrentLevel();
const Parameter achievement_parameters[] = {
  Parameter(kParameterAchievementID,  "ultimate_wizard"),
  Parameter(kParameterCharacter, "mysterion"),
  Parameter(kParameterLevel, current_level),
};
LogEvent(kEventUnlockAchievement, achievement_parameters,
         sizeof(achievement_parameters) /
         sizeof(achievement_parameters[0]));

Constructors and Destructors

Parameter()
Construct an empty parameter.
Parameter(const char *parameter_name, Variant parameter_value)
Construct a parameter.
Parameter(const char *parameter_name, int parameter_value)
Construct a 64-bit integer parameter.
Parameter(const char *parameter_name, int64_t parameter_value)
Construct a 64-bit integer parameter.
Parameter(const char *parameter_name, double parameter_value)
Construct a floating point parameter.
Parameter(const char *parameter_name, const char *parameter_value)
Construct a string parameter.

Public attributes

name
const char *
Name of the parameter.
value
Value of the parameter.

Public attributes

name

const char * firebase::analytics::Parameter::name

Name of the parameter.

Parameter names must be a combination of letters and digits (matching the regular expression [a-zA-Z0-9]) between 1 and 40 characters long starting with a letter [a-zA-Z] character. The "firebase_", "google_" and "ga_" prefixes are reserved and should not be used.

value

Variant firebase::analytics::Parameter::value

Value of the parameter.

See firebase::Variant for usage information.

Public functions

Parameter

 firebase::analytics::Parameter::Parameter()

Construct an empty parameter.

This is provided to allow initialization after construction.

Parameter

 firebase::analytics::Parameter::Parameter(
  const char *parameter_name,
  Variant parameter_value
)

Construct a parameter.

Details
Parameters
parameter_name
Name of the parameter (see Parameter::name).
parameter_value
Value for the parameter. Variants can hold numbers and strings.

Parameter

 firebase::analytics::Parameter::Parameter(
  const char *parameter_name,
  int parameter_value
)

Construct a 64-bit integer parameter.

Details
Parameters
parameter_name
Name of the parameter. (see Parameter::name).
parameter_value
Integer value for the parameter.

Parameter

 firebase::analytics::Parameter::Parameter(
  const char *parameter_name,
  int64_t parameter_value
)

Construct a 64-bit integer parameter.

Details
Parameters
parameter_name
Name of the parameter. (see Parameter::name).
parameter_value
Integer value for the parameter.

Parameter

 firebase::analytics::Parameter::Parameter(
  const char *parameter_name,
  double parameter_value
)

Construct a floating point parameter.

Details
Parameters
parameter_name
Name of the parameter. (see Parameter::name).
parameter_value
Floating point value for the parameter.

Parameter

 firebase::analytics::Parameter::Parameter(
  const char *parameter_name,
  const char *parameter_value
)

Construct a string parameter.

Details
Parameters
parameter_name
Name of the parameter. (see Parameter::name).
parameter_value
String value for the parameter, can be up to 100 characters long.