Links a FirebaseProject
with an existing Google Analytics account.
Using this call, you can either:
- Specify an
analyticsAccountId
to provision a new Google Analytics property within the specified account and associate the new property with yourFirebaseProject
. - Specify an existing
analyticsPropertyId
to associate the property with yourFirebaseProject
.
Note that when you call
projects.addGoogleAnalytics
: - The first check determines if any existing data streams in the Google Analytics property correspond to any existing Firebase Apps in your
FirebaseProject
(based on thepackageName
orbundleId
associated with the data stream). Then, as applicable, the data streams and apps are linked. Note that this auto-linking only applies to Android Apps and iOS Apps. - If no corresponding data streams are found for your Firebase Apps, new data streams are provisioned in the Google Analytics property for each of your Firebase Apps. Note that a new data stream is always provisioned for a Web App even if it was previously associated with a data stream in your Analytics property.
The result of this call is an
Operation
. Poll the Operation
to track the provisioning process by calling operations.get
until done
is true
. When done
is true
, the Operation
has either succeeded or failed. If the Operation
succeeded, its response
is set to an AnalyticsDetails
; if the Operation
failed, its error
is set to a google.rpc.Status
. To call
projects.addGoogleAnalytics
, a member must be an Owner for the existing FirebaseProject
and have the Edit
permission for the Google Analytics account. If a
FirebaseProject
already has Google Analytics enabled, and you call projects.addGoogleAnalytics
using an analyticsPropertyId
that's different from the currently associated property, then the call will fail. Analytics may have already been enabled in the Firebase console or by specifying timeZone
and regionCode
in the call to projects.addFirebase
.
HTTP request
POST https://firebase.googleapis.com/v1beta1/{parent=projects/*}:addGoogleAnalytics
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
parent |
The parent
|
Request body
The request body contains data with the following structure:
JSON representation | |
---|---|
{ // Union field |
Fields | ||
---|---|---|
Union field analytics_resource . Only one Google Analytics resource can be specified in the request body.
analytics_resource can be only one of the following: |
||
analyticsAccountId |
The ID for the existing Google Analytics account that you want to link with your |
|
analyticsPropertyId |
The ID for the existing Google Analytics property that you want to associate with your |
Response body
If successful, the response body contains an instance of Operation
.
Authorization Scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/firebase
For more information, see the Authentication Overview.