Skip to content

Instantly share code, notes, and snippets.

@ptrkstr
Last active February 8, 2022 02:55
Show Gist options
  • Save ptrkstr/5617d4ab629ae86b4c78d5631d1e4f5c to your computer and use it in GitHub Desktop.
Save ptrkstr/5617d4ab629ae86b4c78d5631d1e4f5c to your computer and use it in GitHub Desktop.

Firebase Analytics

Event

Example

{
	"name": "CheckoutComplete",
	"parameters": {
		"total": 9.95,
		"discount": 1.55
	}
}

Requirements

Event

Source

  • Event with same name must have same parameters.
  • Up to 500 event names supported.
  • Using predefined events and/or parameters is recommended for optimal reporting (see Appendix).

Event Name

Source

  • 1 to 40 characters in length.
  • Only alphanumeric or underscore characters.
  • Start with alphabetic character.
  • Not contain a Firebase reserved prefix (see Appendix).
  • Not be a reserved Firebase string (see Appendix).

Parameters

Source

  • Up to 25

Parameter Name

Source

  • 1 to 40 characters in length.
  • Only alphanumeric or underscore characters.
  • Start with alphabetic character.
  • Not contain a Firebase reserved prefix (see Appendix).

Parameter Value

Source

  • Either a String or a Number.

Parameter Value String

Source

  • 0 to 100 characters in length.

Parameter Value Number

Source

  • Either signed 64-bit integer or 64-bit floating-point number.

Screen

Screen tracking is performed using the same format as an event, just with specific predefined values being used .

Example

{
    "name": "screen_view",
    "parameters": {
        "screen_name": "home",
        "screen_class": "HomeViewController"
    }
}
  • Notice the predefined names are used ( screen_view, screen_name , screen_class )
  • screen_name can contain anything that makes sense.
  • screen_class refers to the top level programming class that makes up the screen.

User Stories

Screen Views

The following names in quotes could be what's used for the screen_name value.

GIVEN open application

WHEN on home screen
THEN track "home" screen

WHEN on settings screen
THEN track "settings" screen

Events

GIVEN on checkout screen
WHEN user confirms
THEN track

{
	"name": "CheckoutComplete",
	"parameters": {
		"total": {total cost of purchase},
		"discount": {discount amount applied}
	}
}

Appendix

Reserved Firebase Prefix

Source

  • firebase_
  • google_
  • ga_

Reserved Firebase string

Source

  • ad_activeview
  • ad_click
  • ad_exposure
  • ad_query
  • ad_reward
  • adunit_exposure
  • app_background
  • app_clear_data
  • app_exception
  • app_remove
  • app_store_refund
  • app_store_subscription_cancel
  • app_store_subscription_convert
  • app_store_subscription_renew
  • app_update
  • app_upgrade
  • dynamic_link_app_open
  • dynamic_link_app_update
  • dynamic_link_first_open
  • error
  • firebase_campaign
  • first_open
  • first_visit
  • in_app_purchase
  • notification_dismiss
  • notification_foreground
  • notification_open
  • notification_receive
  • os_update
  • session_start
  • session_start_with_rollout
  • user_engagement

Predefined Event Names

Read the source to know what parameters can be used with each event name.

  • add_payment_info
  • add_to_cart
  • add_to_wishlist
  • ad_impression
  • app_open
  • begin_checkout
  • campaign_details
  • checkout_progress
  • earn_virtual_currency
  • ecommerce_purchase
  • generate_lead
  • join_group
  • level_end
  • level_start
  • level_up
  • login
  • post_score
  • present_offer
  • purchase_refund
  • remove_from_cart
  • screen_view
  • search
  • select_content
  • set_checkout_option
  • share
  • sign_up
  • spend_virtual_currency
  • tutorial_begin
  • tutorial_complete
  • unlock_achievement
  • view_item
  • view_item_list
  • view_search_results
  • add_shipping_info
  • purchase
  • refund
  • select_item
  • select_promotion
  • view_cart
  • view_promotion

Predefined Parameter Names

Read the source to know what value types can be used with each name.

  • achievement_id
  • ad_format
  • aclid
  • ad_platform
  • ad_source
  • ad_unit_name
  • affiliation
  • campaign
  • character
  • checkout_step
  • checkout_option
  • content
  • content_type
  • coupon
  • cp1
  • creative_name
  • creative_slot
  • currency
  • destination
  • end_date
  • flight_number
  • group_id
  • index
  • item_brand
  • item_category
  • item_id
  • item_location_id
  • item_name
  • item_list
  • item_variant
  • level
  • location
  • medium
  • number_of_nights
  • number_of_passengers
  • number_of_rooms
  • origin
  • price
  • quantity
  • score
  • screen_class
  • screen_name
  • search_term
  • shipping
  • sign_up_method
  • method
  • source
  • start_date
  • tax
  • term
  • transaction_id
  • travel_class
  • value
  • virtual_currency_name
  • level_name
  • success
  • extend_session
  • discount
  • item_category2
  • item_category3
  • item_category4
  • item_category5
  • item_list_id
  • item_list_name
  • items
  • location_id
  • payment_type
  • promotion_id
  • promotion_name
  • shipping_tier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment