Analytics reference¶
At a glance¶
Analytics.log_event(name, parameters),log_screen_view(screen_name, screen_class, parameters),set_user_property(value, name),set_user_id(id),set_default_event_parameters(params),set_analytics_collection_enabled(bool),set_session_timeout_interval(seconds),session_id(cb),app_instance_id(),reset_analytics_data(),set_consent(consent),initiate_on_device_conversion_measurement(...),handle_open_url(url),handle_user_activity(activity)Event,Param,UserProperty(every name from the SDK headers),ConsentType,ConsentStatus
pyios_firebase.analytics¶
Google Analytics for Firebase: log events and user properties.
from pyios_firebase.analytics import Analytics, Event, Param
Analytics.log_event(Event.SELECT_CONTENT, {
Param.CONTENT_TYPE: "image",
Param.ITEM_ID: "P12453",
})
Analytics.log_screen_view("Checkout", "CheckoutScreen")
Analytics.set_user_property("premium", "plan")
Screen views are not logged automatically for Kivy screens (the SDK only sees
the one UIViewController): call log_screen_view when a screen opens.
Names and values are checked first: a bad one raises ValueError or
TypeError instead of being dropped quietly by the SDK.
To see events as they are logged, run the app with -FIRDebugEnabled (in
Xcode: Product > Scheme > Edit Scheme > Arguments) and open DebugView in the
Firebase console.
Needs the FirebaseAnalytics framework.
Modules:
| Name | Description |
|---|---|
names |
Names Google Analytics understands, generated from the SDK headers |
Classes:
| Name | Description |
|---|---|
Event |
Event names Google Analytics understands ( |
Param |
Event parameter names Google Analytics understands ( |
UserProperty |
User property names Google Analytics understands ( |
ConsentType |
What a consent covers ( |
ConsentStatus |
A consent's status ( |
Analytics |
Google Analytics. Every method is a static method, as in the SDK:: |
Event
¶
Event names Google Analytics understands (FIREventNames.h).
Attributes:
| Name | Type | Description |
|---|---|---|
AD_IMPRESSION |
Final
|
Ad Impression event. |
ADD_PAYMENT_INFO |
Final
|
Add Payment Info event. |
ADD_SHIPPING_INFO |
Final
|
Add Shipping Info event. |
ADD_TO_CART |
Final
|
E-Commerce Add To Cart event. |
ADD_TO_WISHLIST |
Final
|
E-Commerce Add To Wishlist event. |
APP_OPEN |
Final
|
App Open event. |
BEGIN_CHECKOUT |
Final
|
E-Commerce Begin Checkout event. |
CAMPAIGN_DETAILS |
Final
|
Campaign Detail event. |
EARN_VIRTUAL_CURRENCY |
Final
|
Earn Virtual Currency event. |
GENERATE_LEAD |
Final
|
Generate Lead event. |
IN_APP_PURCHASE |
Final
|
In-App Purchase event. |
JOIN_GROUP |
Final
|
Join Group event. |
LEVEL_END |
Final
|
Level End event. |
LEVEL_START |
Final
|
Level Start event. |
LEVEL_UP |
Final
|
Level Up event. |
LOGIN |
Final
|
Login event. |
POST_SCORE |
Final
|
Post Score event. |
PURCHASE |
Final
|
E-Commerce Purchase event. |
REFUND |
Final
|
E-Commerce Refund event. |
REMOVE_FROM_CART |
Final
|
E-Commerce Remove from Cart event. |
SCREEN_VIEW |
Final
|
Screen View event. |
SEARCH |
Final
|
Search event. |
SELECT_CONTENT |
Final
|
Select Content event. |
SELECT_ITEM |
Final
|
Select Item event. |
SELECT_PROMOTION |
Final
|
Select promotion event. |
SHARE |
Final
|
Share event. |
SIGN_UP |
Final
|
Sign Up event. |
SPEND_VIRTUAL_CURRENCY |
Final
|
Spend Virtual Currency event. |
TUTORIAL_BEGIN |
Final
|
Tutorial Begin event. |
TUTORIAL_COMPLETE |
Final
|
Tutorial End event. |
UNLOCK_ACHIEVEMENT |
Final
|
Unlock Achievement event. |
VIEW_CART |
Final
|
E-commerce View Cart event. |
VIEW_ITEM |
Final
|
View Item event. |
VIEW_ITEM_LIST |
Final
|
View Item List event. |
VIEW_PROMOTION |
Final
|
View Promotion event. |
VIEW_SEARCH_RESULTS |
Final
|
View Search Results event. |
AD_IMPRESSION
class-attribute
instance-attribute
¶
Ad Impression event.
ADD_PAYMENT_INFO
class-attribute
instance-attribute
¶
Add Payment Info event.
ADD_SHIPPING_INFO
class-attribute
instance-attribute
¶
Add Shipping Info event.
ADD_TO_CART
class-attribute
instance-attribute
¶
E-Commerce Add To Cart event.
ADD_TO_WISHLIST
class-attribute
instance-attribute
¶
E-Commerce Add To Wishlist event.
BEGIN_CHECKOUT
class-attribute
instance-attribute
¶
E-Commerce Begin Checkout event.
CAMPAIGN_DETAILS
class-attribute
instance-attribute
¶
Campaign Detail event.
EARN_VIRTUAL_CURRENCY
class-attribute
instance-attribute
¶
Earn Virtual Currency event.
GENERATE_LEAD
class-attribute
instance-attribute
¶
Generate Lead event.
IN_APP_PURCHASE
class-attribute
instance-attribute
¶
In-App Purchase event.
LEVEL_START
class-attribute
instance-attribute
¶
Level Start event.
PURCHASE
class-attribute
instance-attribute
¶
E-Commerce Purchase event.
REMOVE_FROM_CART
class-attribute
instance-attribute
¶
E-Commerce Remove from Cart event.
SCREEN_VIEW
class-attribute
instance-attribute
¶
Screen View event.
SELECT_CONTENT
class-attribute
instance-attribute
¶
Select Content event.
SELECT_ITEM
class-attribute
instance-attribute
¶
Select Item event.
SELECT_PROMOTION
class-attribute
instance-attribute
¶
Select promotion event.
SPEND_VIRTUAL_CURRENCY
class-attribute
instance-attribute
¶
Spend Virtual Currency event.
TUTORIAL_BEGIN
class-attribute
instance-attribute
¶
Tutorial Begin event.
TUTORIAL_COMPLETE
class-attribute
instance-attribute
¶
Tutorial End event.
UNLOCK_ACHIEVEMENT
class-attribute
instance-attribute
¶
Unlock Achievement event.
VIEW_CART
class-attribute
instance-attribute
¶
E-commerce View Cart event.
VIEW_ITEM_LIST
class-attribute
instance-attribute
¶
View Item List event.
VIEW_PROMOTION
class-attribute
instance-attribute
¶
View Promotion event.
VIEW_SEARCH_RESULTS
class-attribute
instance-attribute
¶
View Search Results event.
Param
¶
Event parameter names Google Analytics understands (FIRParameterNames.h).
Attributes:
| Name | Type | Description |
|---|---|---|
ACHIEVEMENT_ID |
Final
|
Game achievement ID (String). |
AD_FORMAT |
Final
|
The ad format (e.g. |
AD_NETWORK_CLICK_ID |
Final
|
Ad Network Click ID (String). |
AD_PLATFORM |
Final
|
The ad platform (e.g. |
AD_SOURCE |
Final
|
The ad source (e.g. |
AD_UNIT_NAME |
Final
|
The ad unit name (e.g. |
AFFILIATION |
Final
|
A product affiliation to designate a supplying company or brick and mortar store location (String). |
CP1 |
Final
|
Campaign custom parameter (String). |
CAMPAIGN |
Final
|
The individual campaign name, slogan, promo code, etc. |
CAMPAIGN_ID |
Final
|
Campaign ID (String). |
CHARACTER |
Final
|
Character used in game (String). |
CONTENT |
Final
|
Campaign content (String). |
CONTENT_TYPE |
Final
|
Type of content selected (String). |
COUPON |
Final
|
Coupon code used for a purchase (String). |
CREATIVE_FORMAT |
Final
|
Creative Format (String). |
CREATIVE_NAME |
Final
|
The name of a creative used in a promotional spot (String). |
CREATIVE_SLOT |
Final
|
The name of a creative slot (String). |
CURRENCY |
Final
|
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format (String). |
DESTINATION |
Final
|
Flight or Travel destination (String). |
DISCOUNT |
Final
|
Monetary value of discount associated with a purchase (Double). |
END_DATE |
Final
|
The arrival date, check-out date or rental end date for the item. |
EXTEND_SESSION |
Final
|
Indicates that the associated event should either extend the current session or start a new session if no session was active when the event was logged. |
FLIGHT_NUMBER |
Final
|
Flight number for travel events (String). |
FREE_TRIAL |
Final
|
Indicates if the user is on a free trial of a subscription. |
GROUP_ID |
Final
|
Group/clan/guild ID (String). |
INDEX |
Final
|
The index of the item in a list (Int). |
ITEM_BRAND |
Final
|
Item brand (String). |
ITEM_CATEGORY |
Final
|
Item category (context-specific) (String). |
ITEM_CATEGORY2 |
Final
|
Item Category (context-specific) (String). |
ITEM_CATEGORY3 |
Final
|
Item Category (context-specific) (String). |
ITEM_CATEGORY4 |
Final
|
Item Category (context-specific) (String). |
ITEM_CATEGORY5 |
Final
|
Item Category (context-specific) (String). |
ITEM_ID |
Final
|
Item ID (context-specific) (String). |
ITEM_LIST_ID |
Final
|
The ID of the list in which the item was presented to the user (String). |
ITEM_LIST_NAME |
Final
|
The name of the list in which the item was presented to the user (String). |
ITEM_NAME |
Final
|
Item Name (context-specific) (String). |
ITEM_VARIANT |
Final
|
Item variant (String). |
ITEMS |
Final
|
The list of items involved in the transaction expressed as |
LEVEL |
Final
|
Level in game (Int). |
LEVEL_NAME |
Final
|
The name of a level in a game (String). |
LOCATION |
Final
|
Location (String). |
LOCATION_ID |
Final
|
The location associated with the event. |
MARKETING_TACTIC |
Final
|
Marketing Tactic (String). |
MEDIUM |
Final
|
The advertising or marketing medium, for example: cpc, banner, email, push. |
METHOD |
Final
|
A particular approach used in an operation; for example, 'facebook' or 'email' in the context of a sign_up or login event. |
NUMBER_OF_NIGHTS |
Final
|
Number of nights staying at hotel (Int). |
NUMBER_OF_PASSENGERS |
Final
|
Number of passengers traveling (Int). |
NUMBER_OF_ROOMS |
Final
|
Number of rooms for travel events (Int). |
ORIGIN |
Final
|
Flight or Travel origin (String). |
PAYMENT_TYPE |
Final
|
The chosen method of payment (String). |
PRICE |
Final
|
Purchase price (Double). |
PRICE_IS_DISCOUNTED |
Final
|
Indicates if an item's price is discounted. |
PRODUCT_ID |
Final
|
The ID of a product (String). |
PRODUCT_NAME |
Final
|
The name of a product (String). |
PROMOTION_ID |
Final
|
The ID of a product promotion (String). |
PROMOTION_NAME |
Final
|
The name of a product promotion (String). |
QUANTITY |
Final
|
Purchase quantity (Int). |
SCORE |
Final
|
Score in game (Int). |
SCREEN_CLASS |
Final
|
Current screen class, such as the class name of the UIViewController, logged with screen_view event and added to every event (String). |
SCREEN_NAME |
Final
|
Current screen name, such as the name of the UIViewController, logged with screen_view event and added to every event (String). |
SEARCH_TERM |
Final
|
The search string/keywords used (String). |
SHIPPING |
Final
|
Shipping cost associated with a transaction (Double). |
SHIPPING_TIER |
Final
|
The shipping tier (e.g. |
SOURCE |
Final
|
The origin of your traffic, such as an Ad network (for example, google) or partner (urban airship). |
SOURCE_PLATFORM |
Final
|
Source Platform (String). |
START_DATE |
Final
|
The departure date, check-in date or rental start date for the item. |
SUBSCRIPTION |
Final
|
Indicates if the purchase is a subscription. |
SUCCESS |
Final
|
The result of an operation. |
TAX |
Final
|
Tax cost associated with a transaction (Double). |
TERM |
Final
|
If you're manually tagging keyword campaigns, you should use utm_term to specify the keyword (String). |
TRANSACTION_ID |
Final
|
The unique identifier of a transaction (String). |
TRAVEL_CLASS |
Final
|
Travel class (String). |
VALUE |
Final
|
A context-specific numeric value which is accumulated automatically for each event type. |
VIRTUAL_CURRENCY_NAME |
Final
|
Name of virtual currency type (String). |
ACHIEVEMENT_ID
class-attribute
instance-attribute
¶
Game achievement ID (String).
AD_NETWORK_CLICK_ID
class-attribute
instance-attribute
¶
Ad Network Click ID (String).
AD_PLATFORM
class-attribute
instance-attribute
¶
The ad platform (e.g.
AD_UNIT_NAME
class-attribute
instance-attribute
¶
The ad unit name (e.g.
AFFILIATION
class-attribute
instance-attribute
¶
A product affiliation to designate a supplying company or brick and mortar store location (String).
CAMPAIGN
class-attribute
instance-attribute
¶
The individual campaign name, slogan, promo code, etc.
CAMPAIGN_ID
class-attribute
instance-attribute
¶
Campaign ID (String).
CHARACTER
class-attribute
instance-attribute
¶
Character used in game (String).
CONTENT_TYPE
class-attribute
instance-attribute
¶
Type of content selected (String).
COUPON
class-attribute
instance-attribute
¶
Coupon code used for a purchase (String).
CREATIVE_FORMAT
class-attribute
instance-attribute
¶
Creative Format (String).
CREATIVE_NAME
class-attribute
instance-attribute
¶
The name of a creative used in a promotional spot (String).
CREATIVE_SLOT
class-attribute
instance-attribute
¶
The name of a creative slot (String).
CURRENCY
class-attribute
instance-attribute
¶
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format (String).
DESTINATION
class-attribute
instance-attribute
¶
Flight or Travel destination (String).
DISCOUNT
class-attribute
instance-attribute
¶
Monetary value of discount associated with a purchase (Double).
END_DATE
class-attribute
instance-attribute
¶
The arrival date, check-out date or rental end date for the item.
EXTEND_SESSION
class-attribute
instance-attribute
¶
Indicates that the associated event should either extend the current session or start a new session if no session was active when the event was logged.
FLIGHT_NUMBER
class-attribute
instance-attribute
¶
Flight number for travel events (String).
FREE_TRIAL
class-attribute
instance-attribute
¶
Indicates if the user is on a free trial of a subscription.
GROUP_ID
class-attribute
instance-attribute
¶
Group/clan/guild ID (String).
INDEX
class-attribute
instance-attribute
¶
The index of the item in a list (Int).
ITEM_BRAND
class-attribute
instance-attribute
¶
Item brand (String).
ITEM_CATEGORY
class-attribute
instance-attribute
¶
Item category (context-specific) (String).
ITEM_CATEGORY2
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_CATEGORY3
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_CATEGORY4
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_CATEGORY5
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_ID
class-attribute
instance-attribute
¶
Item ID (context-specific) (String).
ITEM_LIST_ID
class-attribute
instance-attribute
¶
The ID of the list in which the item was presented to the user (String).
ITEM_LIST_NAME
class-attribute
instance-attribute
¶
The name of the list in which the item was presented to the user (String).
ITEM_NAME
class-attribute
instance-attribute
¶
Item Name (context-specific) (String).
ITEM_VARIANT
class-attribute
instance-attribute
¶
Item variant (String).
ITEMS
class-attribute
instance-attribute
¶
The list of items involved in the transaction expressed as [[String: Any]].
LEVEL_NAME
class-attribute
instance-attribute
¶
The name of a level in a game (String).
LOCATION_ID
class-attribute
instance-attribute
¶
The location associated with the event.
MARKETING_TACTIC
class-attribute
instance-attribute
¶
Marketing Tactic (String).
MEDIUM
class-attribute
instance-attribute
¶
The advertising or marketing medium, for example: cpc, banner, email, push.
METHOD
class-attribute
instance-attribute
¶
A particular approach used in an operation; for example, 'facebook' or 'email' in the context of a sign_up or login event.
NUMBER_OF_NIGHTS
class-attribute
instance-attribute
¶
Number of nights staying at hotel (Int).
NUMBER_OF_PASSENGERS
class-attribute
instance-attribute
¶
Number of passengers traveling (Int).
NUMBER_OF_ROOMS
class-attribute
instance-attribute
¶
Number of rooms for travel events (Int).
ORIGIN
class-attribute
instance-attribute
¶
Flight or Travel origin (String).
PAYMENT_TYPE
class-attribute
instance-attribute
¶
The chosen method of payment (String).
PRICE_IS_DISCOUNTED
class-attribute
instance-attribute
¶
Indicates if an item's price is discounted.
PRODUCT_ID
class-attribute
instance-attribute
¶
The ID of a product (String).
PRODUCT_NAME
class-attribute
instance-attribute
¶
The name of a product (String).
PROMOTION_ID
class-attribute
instance-attribute
¶
The ID of a product promotion (String).
PROMOTION_NAME
class-attribute
instance-attribute
¶
The name of a product promotion (String).
SCREEN_CLASS
class-attribute
instance-attribute
¶
Current screen class, such as the class name of the UIViewController, logged with screen_view event and added to every event (String).
SCREEN_NAME
class-attribute
instance-attribute
¶
Current screen name, such as the name of the UIViewController, logged with screen_view event and added to every event (String).
SEARCH_TERM
class-attribute
instance-attribute
¶
The search string/keywords used (String).
SHIPPING
class-attribute
instance-attribute
¶
Shipping cost associated with a transaction (Double).
SHIPPING_TIER
class-attribute
instance-attribute
¶
The shipping tier (e.g.
SOURCE
class-attribute
instance-attribute
¶
The origin of your traffic, such as an Ad network (for example, google) or partner (urban airship).
SOURCE_PLATFORM
class-attribute
instance-attribute
¶
Source Platform (String).
START_DATE
class-attribute
instance-attribute
¶
The departure date, check-in date or rental start date for the item.
SUBSCRIPTION
class-attribute
instance-attribute
¶
Indicates if the purchase is a subscription.
TAX
class-attribute
instance-attribute
¶
Tax cost associated with a transaction (Double).
TERM
class-attribute
instance-attribute
¶
If you're manually tagging keyword campaigns, you should use utm_term to specify the keyword (String).
TRANSACTION_ID
class-attribute
instance-attribute
¶
The unique identifier of a transaction (String).
TRAVEL_CLASS
class-attribute
instance-attribute
¶
Travel class (String).
VALUE
class-attribute
instance-attribute
¶
A context-specific numeric value which is accumulated automatically for each event type.
VIRTUAL_CURRENCY_NAME
class-attribute
instance-attribute
¶
Name of virtual currency type (String).
UserProperty
¶
User property names Google Analytics understands (FIRUserPropertyNames.h).
Attributes:
| Name | Type | Description |
|---|---|---|
ALLOW_AD_PERSONALIZATION_SIGNALS |
Final
|
Indicates whether events logged by Google Analytics can be used to personalize ads for the user. |
SIGN_UP_METHOD |
Final
|
The method used to sign in. |
ConsentType
¶
What a consent covers (FIRConsentType).
Attributes:
| Name | Type | Description |
|---|---|---|
AD_STORAGE |
Final
|
Storage (such as device identifiers) for advertising. |
ANALYTICS_STORAGE |
Final
|
Storage (such as app identifiers) for analytics. |
AD_USER_DATA |
Final
|
Sending user data to Google for advertising. |
AD_PERSONALIZATION |
Final
|
Personalized advertising (remarketing). |
AD_STORAGE
class-attribute
instance-attribute
¶
Storage (such as device identifiers) for advertising.
ANALYTICS_STORAGE
class-attribute
instance-attribute
¶
Storage (such as app identifiers) for analytics.
AD_USER_DATA
class-attribute
instance-attribute
¶
Sending user data to Google for advertising.
AD_PERSONALIZATION
class-attribute
instance-attribute
¶
Personalized advertising (remarketing).
ConsentStatus
¶
A consent's status (FIRConsentStatus).
Analytics
¶
Google Analytics. Every method is a static method, as in the SDK::
Analytics.log_event("level_up", {"level": 3})
Methods:
| Name | Description |
|---|---|
log_event |
Log an event. |
log_screen_view |
Log that a screen was shown (the |
set_user_property |
Set a user property, to filter and compare users in reports. Register |
set_user_id |
Set the user ID (your own ID for the user; never personal data such |
set_analytics_collection_enabled |
Turn collection on or off. The setting is kept across launches. To |
set_session_timeout_interval |
How long the app can be inactive before the session ends (default |
session_id |
The current session's ID. |
app_instance_id |
This app install's ID, or |
reset_analytics_data |
Clear the data on this device and make a new app instance ID. |
set_default_event_parameters |
Parameters added to every event logged from now on (kept across |
set_consent |
Set the user's consent (Google consent mode). Types left out keep |
initiate_on_device_conversion_measurement |
Google Ads on-device conversion measurement, from what the user |
handle_open_url |
Tell Analytics the app was opened from a URL (campaign attribution). |
handle_user_activity |
Tell Analytics about a universal link the app was opened with. Only |
log_event
staticmethod
¶
Log an event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the event name: an |
required |
parameters
|
Mapping[str, Any] | None
|
up to 25 parameters: |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
an invalid or reserved name, or too many parameters. |
TypeError
|
a value of another type ( |
log_screen_view
staticmethod
¶
log_screen_view(
screen_name: str,
screen_class: str | None = None,
parameters: Mapping[str, Any] | None = None,
) -> None
Log that a screen was shown (the screen_view event).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
screen_name
|
str
|
the screen's name, for example |
required |
screen_class
|
str | None
|
the screen's class, for example the Kivy |
None
|
parameters
|
Mapping[str, Any] | None
|
more parameters for the event. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
an invalid parameter name. |
TypeError
|
a parameter value of another type. |
set_user_property
staticmethod
¶
Set a user property, to filter and compare users in reports. Register it in the Firebase console (Custom definitions) to see it there.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | None
|
the value (up to 36 characters), or |
required |
name
|
str
|
the property name (1 to 24 letters, digits and underscores, starting with a letter). |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
an invalid or reserved name, or a value over 36 characters. |
TypeError
|
|
set_user_id
staticmethod
¶
Set the user ID (your own ID for the user; never personal data such as an email address).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str | None
|
up to 256 characters, or |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
an empty ID or one over 256 characters. |
set_analytics_collection_enabled
staticmethod
¶
Turn collection on or off. The setting is kept across launches. To
start the app with it off, set FIREBASE_ANALYTICS_COLLECTION_ENABLED
to NO in Info.plist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
enabled
|
bool
|
|
required |
set_session_timeout_interval
staticmethod
¶
How long the app can be inactive before the session ends (default 1800 s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds
|
float
|
the timeout. |
required |
session_id
staticmethod
¶
session_id(
callback: Callable[
[int | None, FirebaseError | None], None
],
) -> None
The current session's ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
Callable[[int | None, FirebaseError | None], None]
|
gets |
required |
app_instance_id
staticmethod
¶
This app install's ID, or None when ANALYTICS_STORAGE
consent is denied.
reset_analytics_data
staticmethod
¶
Clear the data on this device and make a new app instance ID.
set_default_event_parameters
staticmethod
¶
Parameters added to every event logged from now on (kept across launches).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
Mapping[str, Any] | None
|
parameter names to values (a |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
an invalid name. |
TypeError
|
a value of another type. |
set_consent
staticmethod
¶
Set the user's consent (Google consent mode). Types left out keep their status.
::
Analytics.set_consent({
ConsentType.ANALYTICS_STORAGE: ConsentStatus.GRANTED,
ConsentType.AD_STORAGE: ConsentStatus.DENIED,
})
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
consent
|
Mapping[str, str]
|
|
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
an unknown type or status. |
initiate_on_device_conversion_measurement
staticmethod
¶
initiate_on_device_conversion_measurement(
*,
email_address: str | None = None,
phone_number: str | None = None,
hashed_email_address: bytes | None = None,
hashed_phone_number: bytes | None = None,
) -> None
Google Ads on-device conversion measurement, from what the user
consented to share. Give exactly one argument. Needs the
GoogleAdsOnDeviceConversion package in the app (otherwise it does
nothing).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email_address
|
str | None
|
the email address. |
None
|
phone_number
|
str | None
|
the phone number in E.164 format ( |
None
|
hashed_email_address
|
bytes | None
|
the SHA-256 of the normalized email address. |
None
|
hashed_phone_number
|
bytes | None
|
the SHA-256 of the phone number in E.164 format. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
not exactly one argument. |
handle_open_url
staticmethod
¶
Tell Analytics the app was opened from a URL (campaign attribution).
Only needed when FirebaseAppDelegateProxyEnabled is NO.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
the URL the app was opened with. |
required |
handle_user_activity
staticmethod
¶
handle_user_activity(user_activity: ObjCObject) -> None
Tell Analytics about a universal link the app was opened with. Only
needed when FirebaseAppDelegateProxyEnabled is NO.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_activity
|
ObjCObject
|
the |
required |
pyios_firebase.analytics.names¶
Names Google Analytics understands, generated from the SDK headers
(FIREventNames.h, FIRParameterNames.h, FIRUserPropertyNames.h).
Use them for the reports Analytics builds from them (e-commerce, levels, screens...). Your own names work too.
Classes:
| Name | Description |
|---|---|
Event |
Event names Google Analytics understands ( |
Param |
Event parameter names Google Analytics understands ( |
UserProperty |
User property names Google Analytics understands ( |
Event
¶
Event names Google Analytics understands (FIREventNames.h).
Attributes:
| Name | Type | Description |
|---|---|---|
AD_IMPRESSION |
Final
|
Ad Impression event. |
ADD_PAYMENT_INFO |
Final
|
Add Payment Info event. |
ADD_SHIPPING_INFO |
Final
|
Add Shipping Info event. |
ADD_TO_CART |
Final
|
E-Commerce Add To Cart event. |
ADD_TO_WISHLIST |
Final
|
E-Commerce Add To Wishlist event. |
APP_OPEN |
Final
|
App Open event. |
BEGIN_CHECKOUT |
Final
|
E-Commerce Begin Checkout event. |
CAMPAIGN_DETAILS |
Final
|
Campaign Detail event. |
EARN_VIRTUAL_CURRENCY |
Final
|
Earn Virtual Currency event. |
GENERATE_LEAD |
Final
|
Generate Lead event. |
IN_APP_PURCHASE |
Final
|
In-App Purchase event. |
JOIN_GROUP |
Final
|
Join Group event. |
LEVEL_END |
Final
|
Level End event. |
LEVEL_START |
Final
|
Level Start event. |
LEVEL_UP |
Final
|
Level Up event. |
LOGIN |
Final
|
Login event. |
POST_SCORE |
Final
|
Post Score event. |
PURCHASE |
Final
|
E-Commerce Purchase event. |
REFUND |
Final
|
E-Commerce Refund event. |
REMOVE_FROM_CART |
Final
|
E-Commerce Remove from Cart event. |
SCREEN_VIEW |
Final
|
Screen View event. |
SEARCH |
Final
|
Search event. |
SELECT_CONTENT |
Final
|
Select Content event. |
SELECT_ITEM |
Final
|
Select Item event. |
SELECT_PROMOTION |
Final
|
Select promotion event. |
SHARE |
Final
|
Share event. |
SIGN_UP |
Final
|
Sign Up event. |
SPEND_VIRTUAL_CURRENCY |
Final
|
Spend Virtual Currency event. |
TUTORIAL_BEGIN |
Final
|
Tutorial Begin event. |
TUTORIAL_COMPLETE |
Final
|
Tutorial End event. |
UNLOCK_ACHIEVEMENT |
Final
|
Unlock Achievement event. |
VIEW_CART |
Final
|
E-commerce View Cart event. |
VIEW_ITEM |
Final
|
View Item event. |
VIEW_ITEM_LIST |
Final
|
View Item List event. |
VIEW_PROMOTION |
Final
|
View Promotion event. |
VIEW_SEARCH_RESULTS |
Final
|
View Search Results event. |
AD_IMPRESSION
class-attribute
instance-attribute
¶
Ad Impression event.
ADD_PAYMENT_INFO
class-attribute
instance-attribute
¶
Add Payment Info event.
ADD_SHIPPING_INFO
class-attribute
instance-attribute
¶
Add Shipping Info event.
ADD_TO_CART
class-attribute
instance-attribute
¶
E-Commerce Add To Cart event.
ADD_TO_WISHLIST
class-attribute
instance-attribute
¶
E-Commerce Add To Wishlist event.
BEGIN_CHECKOUT
class-attribute
instance-attribute
¶
E-Commerce Begin Checkout event.
CAMPAIGN_DETAILS
class-attribute
instance-attribute
¶
Campaign Detail event.
EARN_VIRTUAL_CURRENCY
class-attribute
instance-attribute
¶
Earn Virtual Currency event.
GENERATE_LEAD
class-attribute
instance-attribute
¶
Generate Lead event.
IN_APP_PURCHASE
class-attribute
instance-attribute
¶
In-App Purchase event.
LEVEL_START
class-attribute
instance-attribute
¶
Level Start event.
PURCHASE
class-attribute
instance-attribute
¶
E-Commerce Purchase event.
REMOVE_FROM_CART
class-attribute
instance-attribute
¶
E-Commerce Remove from Cart event.
SCREEN_VIEW
class-attribute
instance-attribute
¶
Screen View event.
SELECT_CONTENT
class-attribute
instance-attribute
¶
Select Content event.
SELECT_ITEM
class-attribute
instance-attribute
¶
Select Item event.
SELECT_PROMOTION
class-attribute
instance-attribute
¶
Select promotion event.
SPEND_VIRTUAL_CURRENCY
class-attribute
instance-attribute
¶
Spend Virtual Currency event.
TUTORIAL_BEGIN
class-attribute
instance-attribute
¶
Tutorial Begin event.
TUTORIAL_COMPLETE
class-attribute
instance-attribute
¶
Tutorial End event.
UNLOCK_ACHIEVEMENT
class-attribute
instance-attribute
¶
Unlock Achievement event.
VIEW_CART
class-attribute
instance-attribute
¶
E-commerce View Cart event.
VIEW_ITEM_LIST
class-attribute
instance-attribute
¶
View Item List event.
VIEW_PROMOTION
class-attribute
instance-attribute
¶
View Promotion event.
VIEW_SEARCH_RESULTS
class-attribute
instance-attribute
¶
View Search Results event.
Param
¶
Event parameter names Google Analytics understands (FIRParameterNames.h).
Attributes:
| Name | Type | Description |
|---|---|---|
ACHIEVEMENT_ID |
Final
|
Game achievement ID (String). |
AD_FORMAT |
Final
|
The ad format (e.g. |
AD_NETWORK_CLICK_ID |
Final
|
Ad Network Click ID (String). |
AD_PLATFORM |
Final
|
The ad platform (e.g. |
AD_SOURCE |
Final
|
The ad source (e.g. |
AD_UNIT_NAME |
Final
|
The ad unit name (e.g. |
AFFILIATION |
Final
|
A product affiliation to designate a supplying company or brick and mortar store location (String). |
CP1 |
Final
|
Campaign custom parameter (String). |
CAMPAIGN |
Final
|
The individual campaign name, slogan, promo code, etc. |
CAMPAIGN_ID |
Final
|
Campaign ID (String). |
CHARACTER |
Final
|
Character used in game (String). |
CONTENT |
Final
|
Campaign content (String). |
CONTENT_TYPE |
Final
|
Type of content selected (String). |
COUPON |
Final
|
Coupon code used for a purchase (String). |
CREATIVE_FORMAT |
Final
|
Creative Format (String). |
CREATIVE_NAME |
Final
|
The name of a creative used in a promotional spot (String). |
CREATIVE_SLOT |
Final
|
The name of a creative slot (String). |
CURRENCY |
Final
|
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format (String). |
DESTINATION |
Final
|
Flight or Travel destination (String). |
DISCOUNT |
Final
|
Monetary value of discount associated with a purchase (Double). |
END_DATE |
Final
|
The arrival date, check-out date or rental end date for the item. |
EXTEND_SESSION |
Final
|
Indicates that the associated event should either extend the current session or start a new session if no session was active when the event was logged. |
FLIGHT_NUMBER |
Final
|
Flight number for travel events (String). |
FREE_TRIAL |
Final
|
Indicates if the user is on a free trial of a subscription. |
GROUP_ID |
Final
|
Group/clan/guild ID (String). |
INDEX |
Final
|
The index of the item in a list (Int). |
ITEM_BRAND |
Final
|
Item brand (String). |
ITEM_CATEGORY |
Final
|
Item category (context-specific) (String). |
ITEM_CATEGORY2 |
Final
|
Item Category (context-specific) (String). |
ITEM_CATEGORY3 |
Final
|
Item Category (context-specific) (String). |
ITEM_CATEGORY4 |
Final
|
Item Category (context-specific) (String). |
ITEM_CATEGORY5 |
Final
|
Item Category (context-specific) (String). |
ITEM_ID |
Final
|
Item ID (context-specific) (String). |
ITEM_LIST_ID |
Final
|
The ID of the list in which the item was presented to the user (String). |
ITEM_LIST_NAME |
Final
|
The name of the list in which the item was presented to the user (String). |
ITEM_NAME |
Final
|
Item Name (context-specific) (String). |
ITEM_VARIANT |
Final
|
Item variant (String). |
ITEMS |
Final
|
The list of items involved in the transaction expressed as |
LEVEL |
Final
|
Level in game (Int). |
LEVEL_NAME |
Final
|
The name of a level in a game (String). |
LOCATION |
Final
|
Location (String). |
LOCATION_ID |
Final
|
The location associated with the event. |
MARKETING_TACTIC |
Final
|
Marketing Tactic (String). |
MEDIUM |
Final
|
The advertising or marketing medium, for example: cpc, banner, email, push. |
METHOD |
Final
|
A particular approach used in an operation; for example, 'facebook' or 'email' in the context of a sign_up or login event. |
NUMBER_OF_NIGHTS |
Final
|
Number of nights staying at hotel (Int). |
NUMBER_OF_PASSENGERS |
Final
|
Number of passengers traveling (Int). |
NUMBER_OF_ROOMS |
Final
|
Number of rooms for travel events (Int). |
ORIGIN |
Final
|
Flight or Travel origin (String). |
PAYMENT_TYPE |
Final
|
The chosen method of payment (String). |
PRICE |
Final
|
Purchase price (Double). |
PRICE_IS_DISCOUNTED |
Final
|
Indicates if an item's price is discounted. |
PRODUCT_ID |
Final
|
The ID of a product (String). |
PRODUCT_NAME |
Final
|
The name of a product (String). |
PROMOTION_ID |
Final
|
The ID of a product promotion (String). |
PROMOTION_NAME |
Final
|
The name of a product promotion (String). |
QUANTITY |
Final
|
Purchase quantity (Int). |
SCORE |
Final
|
Score in game (Int). |
SCREEN_CLASS |
Final
|
Current screen class, such as the class name of the UIViewController, logged with screen_view event and added to every event (String). |
SCREEN_NAME |
Final
|
Current screen name, such as the name of the UIViewController, logged with screen_view event and added to every event (String). |
SEARCH_TERM |
Final
|
The search string/keywords used (String). |
SHIPPING |
Final
|
Shipping cost associated with a transaction (Double). |
SHIPPING_TIER |
Final
|
The shipping tier (e.g. |
SOURCE |
Final
|
The origin of your traffic, such as an Ad network (for example, google) or partner (urban airship). |
SOURCE_PLATFORM |
Final
|
Source Platform (String). |
START_DATE |
Final
|
The departure date, check-in date or rental start date for the item. |
SUBSCRIPTION |
Final
|
Indicates if the purchase is a subscription. |
SUCCESS |
Final
|
The result of an operation. |
TAX |
Final
|
Tax cost associated with a transaction (Double). |
TERM |
Final
|
If you're manually tagging keyword campaigns, you should use utm_term to specify the keyword (String). |
TRANSACTION_ID |
Final
|
The unique identifier of a transaction (String). |
TRAVEL_CLASS |
Final
|
Travel class (String). |
VALUE |
Final
|
A context-specific numeric value which is accumulated automatically for each event type. |
VIRTUAL_CURRENCY_NAME |
Final
|
Name of virtual currency type (String). |
ACHIEVEMENT_ID
class-attribute
instance-attribute
¶
Game achievement ID (String).
AD_NETWORK_CLICK_ID
class-attribute
instance-attribute
¶
Ad Network Click ID (String).
AD_PLATFORM
class-attribute
instance-attribute
¶
The ad platform (e.g.
AD_UNIT_NAME
class-attribute
instance-attribute
¶
The ad unit name (e.g.
AFFILIATION
class-attribute
instance-attribute
¶
A product affiliation to designate a supplying company or brick and mortar store location (String).
CAMPAIGN
class-attribute
instance-attribute
¶
The individual campaign name, slogan, promo code, etc.
CAMPAIGN_ID
class-attribute
instance-attribute
¶
Campaign ID (String).
CHARACTER
class-attribute
instance-attribute
¶
Character used in game (String).
CONTENT_TYPE
class-attribute
instance-attribute
¶
Type of content selected (String).
COUPON
class-attribute
instance-attribute
¶
Coupon code used for a purchase (String).
CREATIVE_FORMAT
class-attribute
instance-attribute
¶
Creative Format (String).
CREATIVE_NAME
class-attribute
instance-attribute
¶
The name of a creative used in a promotional spot (String).
CREATIVE_SLOT
class-attribute
instance-attribute
¶
The name of a creative slot (String).
CURRENCY
class-attribute
instance-attribute
¶
Currency of the purchase or items associated with the event, in 3-letter ISO_4217 format (String).
DESTINATION
class-attribute
instance-attribute
¶
Flight or Travel destination (String).
DISCOUNT
class-attribute
instance-attribute
¶
Monetary value of discount associated with a purchase (Double).
END_DATE
class-attribute
instance-attribute
¶
The arrival date, check-out date or rental end date for the item.
EXTEND_SESSION
class-attribute
instance-attribute
¶
Indicates that the associated event should either extend the current session or start a new session if no session was active when the event was logged.
FLIGHT_NUMBER
class-attribute
instance-attribute
¶
Flight number for travel events (String).
FREE_TRIAL
class-attribute
instance-attribute
¶
Indicates if the user is on a free trial of a subscription.
GROUP_ID
class-attribute
instance-attribute
¶
Group/clan/guild ID (String).
INDEX
class-attribute
instance-attribute
¶
The index of the item in a list (Int).
ITEM_BRAND
class-attribute
instance-attribute
¶
Item brand (String).
ITEM_CATEGORY
class-attribute
instance-attribute
¶
Item category (context-specific) (String).
ITEM_CATEGORY2
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_CATEGORY3
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_CATEGORY4
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_CATEGORY5
class-attribute
instance-attribute
¶
Item Category (context-specific) (String).
ITEM_ID
class-attribute
instance-attribute
¶
Item ID (context-specific) (String).
ITEM_LIST_ID
class-attribute
instance-attribute
¶
The ID of the list in which the item was presented to the user (String).
ITEM_LIST_NAME
class-attribute
instance-attribute
¶
The name of the list in which the item was presented to the user (String).
ITEM_NAME
class-attribute
instance-attribute
¶
Item Name (context-specific) (String).
ITEM_VARIANT
class-attribute
instance-attribute
¶
Item variant (String).
ITEMS
class-attribute
instance-attribute
¶
The list of items involved in the transaction expressed as [[String: Any]].
LEVEL_NAME
class-attribute
instance-attribute
¶
The name of a level in a game (String).
LOCATION_ID
class-attribute
instance-attribute
¶
The location associated with the event.
MARKETING_TACTIC
class-attribute
instance-attribute
¶
Marketing Tactic (String).
MEDIUM
class-attribute
instance-attribute
¶
The advertising or marketing medium, for example: cpc, banner, email, push.
METHOD
class-attribute
instance-attribute
¶
A particular approach used in an operation; for example, 'facebook' or 'email' in the context of a sign_up or login event.
NUMBER_OF_NIGHTS
class-attribute
instance-attribute
¶
Number of nights staying at hotel (Int).
NUMBER_OF_PASSENGERS
class-attribute
instance-attribute
¶
Number of passengers traveling (Int).
NUMBER_OF_ROOMS
class-attribute
instance-attribute
¶
Number of rooms for travel events (Int).
ORIGIN
class-attribute
instance-attribute
¶
Flight or Travel origin (String).
PAYMENT_TYPE
class-attribute
instance-attribute
¶
The chosen method of payment (String).
PRICE_IS_DISCOUNTED
class-attribute
instance-attribute
¶
Indicates if an item's price is discounted.
PRODUCT_ID
class-attribute
instance-attribute
¶
The ID of a product (String).
PRODUCT_NAME
class-attribute
instance-attribute
¶
The name of a product (String).
PROMOTION_ID
class-attribute
instance-attribute
¶
The ID of a product promotion (String).
PROMOTION_NAME
class-attribute
instance-attribute
¶
The name of a product promotion (String).
SCREEN_CLASS
class-attribute
instance-attribute
¶
Current screen class, such as the class name of the UIViewController, logged with screen_view event and added to every event (String).
SCREEN_NAME
class-attribute
instance-attribute
¶
Current screen name, such as the name of the UIViewController, logged with screen_view event and added to every event (String).
SEARCH_TERM
class-attribute
instance-attribute
¶
The search string/keywords used (String).
SHIPPING
class-attribute
instance-attribute
¶
Shipping cost associated with a transaction (Double).
SHIPPING_TIER
class-attribute
instance-attribute
¶
The shipping tier (e.g.
SOURCE
class-attribute
instance-attribute
¶
The origin of your traffic, such as an Ad network (for example, google) or partner (urban airship).
SOURCE_PLATFORM
class-attribute
instance-attribute
¶
Source Platform (String).
START_DATE
class-attribute
instance-attribute
¶
The departure date, check-in date or rental start date for the item.
SUBSCRIPTION
class-attribute
instance-attribute
¶
Indicates if the purchase is a subscription.
TAX
class-attribute
instance-attribute
¶
Tax cost associated with a transaction (Double).
TERM
class-attribute
instance-attribute
¶
If you're manually tagging keyword campaigns, you should use utm_term to specify the keyword (String).
TRANSACTION_ID
class-attribute
instance-attribute
¶
The unique identifier of a transaction (String).
TRAVEL_CLASS
class-attribute
instance-attribute
¶
Travel class (String).
VALUE
class-attribute
instance-attribute
¶
A context-specific numeric value which is accumulated automatically for each event type.
VIRTUAL_CURRENCY_NAME
class-attribute
instance-attribute
¶
Name of virtual currency type (String).
UserProperty
¶
User property names Google Analytics understands (FIRUserPropertyNames.h).
Attributes:
| Name | Type | Description |
|---|---|---|
ALLOW_AD_PERSONALIZATION_SIGNALS |
Final
|
Indicates whether events logged by Google Analytics can be used to personalize ads for the user. |
SIGN_UP_METHOD |
Final
|
The method used to sign in. |