Redirect Notice

Redirect Notice

The page you requested has been relocated to Player Docs.


The AmpFirebase plugin, provides the event reporting basics on playback and ads using the AmpPlayer for iOS.


Just import the AmpFirebase.framework in your project. For more information check out the Amp,Core’s documentation.

Note: Since Firebase works as a static library, importing Google’s libraries should not be required. At the current version the libraries used are FirebaseAnalytics (6.1.1), FIRAnalyticsConnector, FirebaseCoreDiagnostics (1.0.1), FirebaseInstanceID (4.2.5), GoogleDataTransport (1.2.0), GoogleUtilities (6.2.5), GoogleDataTransportCCTSupport (1.0.3), FirebaseCore (6.2.3), nanopb (0.3.901) and GoogleAppMeasurement (6.1.1). If their versions don’t match the latest and you need this support please contact our team.

How to Use

Let’s import the required frameworks:

import AmpCore
import AmpFirebase

To start reporting to Firebase using our plugin simply create a new instance of the AmpFirebase class.

AmpFirebase(player:AmpPlayer, trackingList:[AmpTracking], fbArgs:AmpFirebaseArgs?)
  • player: Instance of the player you want to track
  • trackingList: The events you want to log
  • fbArgs: The instance of the class that can add custom parameters. No need to pass a value if you don’t need this


This enum contains every event available for you to track. There are two kinds of cases the SingleTags and the MultiTags, the SingleTags will handle events individually while the MultiTags will handle groups of correlated events. Please keep in mind that failing to specify the events will result in not logging at all.


Event Definition MultiTag SingleTag
Play request Triggers when the…) event is called playback playRequest
Playback start Triggers when the first frame of the video has been player (Only once) playback playbackStarted
Pause Triggers when the playback pauses due to a user/client pause call playback pause
Resume Triggers when the playback recovers from an user/client pause call playback resume
Buffering start Triggers when playback is interrupted due to the absence of video buffer playback bufferingStart
Buffering end Triggers when the playback has recovered from a buffering event playback bufferingEnd
Seek start Triggers when a forced seek to a specific time on the video is performed playback seekStart
Seek end Triggers when the playback has recovered from a forced seek playback seekEnd
Bitrate switch Triggers when the bitrate of the video has changed due to network and buffer conditions playback bitrateSwitch
On background Triggers when the app has gone to background playback onBackground
On foreground Triggers when the app has returned to foreground playback onForeground
Stop Triggers when the video is stopped playback stop
End Triggers at the end of the video playback end
Error Triggers whenever and error on the playback occurs playback error
Ad break start Triggers at the start of an ad break ads adBreakStart
Ad break end Triggers at the end of an ad break ads adBreakEnd
Ad loaded Triggers when and ad has been loaded successfully (always before and ad start) ads adLoaded
Ad start Triggers when an ad starts playing ads adStart
Ad end Triggers when an ad concludes ads adEnd
Ad pause Triggers when an ad has been paused ads adPause
Ad resume Triggers when an ad resumes from a pause ads adResume
Ad error Triggers when and error occurs while loading an ad ads adError
Captions on Triggers when the closed captions have been enabled captions captionsEnabled
Captions off Triggers when the closed captions have been disabled captions captionsDisabled


The parameters sent to Firebase from any implementation are already set. You should always be able to see ampSessionId and ampTimestamp, also in some events like an error you should be able to see ampErrorMessage as well.

As this simple implementation won’t cover every user needs, you can include your own custom log parameters by using the AmpFirebaseArgs class.

Just create your own class which inherits from AmpFirebaseArgs and override the methods that contains the parameters of the event. Then send an instance of this class to the constructor of the AmpFirebase

class MyFirebaseArgs: AmpFirebaseArgs {
	override func getPauseArgs() -> [String : Any] {
		return ["name":"value"]

There are different scopes in which you can add parameters to the Firebase event logs.

Global: Add the arguments to every event that the plugin will log. Use: getGlobalArgs()

MultiTag: Add the arguments to every event contained in the MultiTag that the plugin will log. Use: getPlaybackArgs(), getAdsArgs(), getCaptionsArgs()

SingleTag: Add the arguments to specific event. eg. getPauseArgs()

Important: Please be aware that the scopes of the arguments you can customize hold a priority hierarchy, so if there is a conflict with an argument name the priority will determine the value that the name holds. The Global arguments will have the lowest priority meaning if there is a name conflict its value will always be overwritten. MultiTag arguments will hold the next priority position and SingleTag arguments will hold the top priority over every other (except for plugin default arguments). The AmpFirebase plugin will take priority over every custom argument, so don’t use the same name to you arguments since it won’t make a difference :D