0.0.20241030 • Published 9 months ago

@maxim_mazurok/gapi.client.analyticsadmin-v1beta v0.0.20241030

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

TypeScript typings for Google Analytics Admin API v1beta

Manage properties in Google Analytics. Warning: Creating multiple Customer Applications, Accounts, or Projects to simulate or act as a single Customer Application, Account, or Project (respectively) or to circumvent Service-specific usage limits or quotas is a direct violation of Google Cloud Platform Terms of Service as well as Google APIs Terms of Service. These actions can result in immediate termination of your GCP project(s) without any warning. For detailed description please check documentation.

Installing

Install typings for Google Analytics Admin API:

npm install @types/gapi.client.analyticsadmin-v1beta --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://analyticsadmin.googleapis.com/$discovery/rest?version=v1beta',
  () => {
    // now we can use:
    // gapi.client.analyticsadmin
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('analyticsadmin', 'v1beta', () => {
  // now we can use:
  // gapi.client.analyticsadmin
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // Edit Google Analytics management entities
    'https://www.googleapis.com/auth/analytics.edit',

    // See and download your Google Analytics data
    'https://www.googleapis.com/auth/analytics.readonly',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Google Analytics Admin API resources:

/*
Marks target Account as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted accounts. However, they can be restored using the Trash Can UI. If the accounts are not restored before the expiration time, the account and all child resources (eg: Properties, GoogleAdsLinks, Streams, AccessBindings) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.
*/
await gapi.client.analyticsadmin.accounts.delete({name: 'name'});

/*
Lookup for a single Account.
*/
await gapi.client.analyticsadmin.accounts.get({name: 'name'});

/*
Get data sharing settings on an account. Data sharing settings are singletons.
*/
await gapi.client.analyticsadmin.accounts.getDataSharingSettings({
  name: 'name',
});

/*
Returns all accounts accessible by the caller. Note that these accounts might not currently have GA properties. Soft-deleted (ie: "trashed") accounts are excluded by default. Returns an empty list if no relevant accounts are found.
*/
await gapi.client.analyticsadmin.accounts.list({});

/*
Updates an account.
*/
await gapi.client.analyticsadmin.accounts.patch({name: 'name'});

/*
Requests a ticket for creating an account.
*/
await gapi.client.analyticsadmin.accounts.provisionAccountTicket({});

/*
Returns a customized report of data access records. The report provides records of each time a user reads Google Analytics reporting data. Access records are retained for up to 2 years. Data Access Reports can be requested for a property. Reports may be requested for any property, but dimensions that aren't related to quota can only be requested on Google Analytics 360 properties. This method is only available to Administrators. These data access records include GA UI Reporting, GA UI Explorations, GA Data API, and other products like Firebase & Admob that can retrieve data from Google Analytics through a linkage. These records don't include property configuration changes like adding a stream or changing a property's time zone. For configuration change history, see [searchChangeHistoryEvents](https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents). To give your feedback on this API, complete the [Google Analytics Access Reports feedback](https://docs.google.com/forms/d/e/1FAIpQLSdmEBUrMzAEdiEKk5TV5dEHvDUZDRlgWYdQdAeSdtR4hVjEhw/viewform) form.
*/
await gapi.client.analyticsadmin.accounts.runAccessReport({entity: 'entity'});

/*
Searches through all changes to an account or its children given the specified set of filters.
*/
await gapi.client.analyticsadmin.accounts.searchChangeHistoryEvents({
  account: 'account',
});

/*
Returns summaries of all accounts accessible by the caller.
*/
await gapi.client.analyticsadmin.accountSummaries.list({});

/*
Acknowledges the terms of user data collection for the specified property. This acknowledgement must be completed (either in the Google Analytics UI or through this API) before MeasurementProtocolSecret resources may be created.
*/
await gapi.client.analyticsadmin.properties.acknowledgeUserDataCollection({
  property: 'property',
});

/*
Creates a Google Analytics property with the specified location and attributes.
*/
await gapi.client.analyticsadmin.properties.create({});

/*
Marks target Property as soft-deleted (ie: "trashed") and returns it. This API does not have a method to restore soft-deleted properties. However, they can be restored using the Trash Can UI. If the properties are not restored before the expiration time, the Property and all child resources (eg: GoogleAdsLinks, Streams, AccessBindings) will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found.
*/
await gapi.client.analyticsadmin.properties.delete({name: 'name'});

/*
Lookup for a single GA Property.
*/
await gapi.client.analyticsadmin.properties.get({name: 'name'});

/*
Returns the singleton data retention settings for this property.
*/
await gapi.client.analyticsadmin.properties.getDataRetentionSettings({
  name: 'name',
});

/*
Returns child Properties under the specified parent Account. Properties will be excluded if the caller does not have access. Soft-deleted (ie: "trashed") properties are excluded by default. Returns an empty list if no relevant properties are found.
*/
await gapi.client.analyticsadmin.properties.list({});

/*
Updates a property.
*/
await gapi.client.analyticsadmin.properties.patch({name: 'name'});

/*
Returns a customized report of data access records. The report provides records of each time a user reads Google Analytics reporting data. Access records are retained for up to 2 years. Data Access Reports can be requested for a property. Reports may be requested for any property, but dimensions that aren't related to quota can only be requested on Google Analytics 360 properties. This method is only available to Administrators. These data access records include GA UI Reporting, GA UI Explorations, GA Data API, and other products like Firebase & Admob that can retrieve data from Google Analytics through a linkage. These records don't include property configuration changes like adding a stream or changing a property's time zone. For configuration change history, see [searchChangeHistoryEvents](https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents). To give your feedback on this API, complete the [Google Analytics Access Reports feedback](https://docs.google.com/forms/d/e/1FAIpQLSdmEBUrMzAEdiEKk5TV5dEHvDUZDRlgWYdQdAeSdtR4hVjEhw/viewform) form.
*/
await gapi.client.analyticsadmin.properties.runAccessReport({entity: 'entity'});

/*
Updates the singleton data retention settings for this property.
*/
await gapi.client.analyticsadmin.properties.updateDataRetentionSettings({
  name: 'name',
});
0.0.20241025

9 months ago

0.0.20241030

9 months ago

0.0.20241029

9 months ago

0.0.20241023

9 months ago

0.0.20241022

9 months ago

0.0.20241021

9 months ago

0.0.20241018

9 months ago

0.0.20241016

10 months ago

0.0.20241015

10 months ago

0.0.20241014

10 months ago

0.0.20240929

10 months ago

0.0.20240925

10 months ago

0.0.20240924

10 months ago

0.0.20240930

10 months ago

0.0.20241004

10 months ago

0.0.20241002

10 months ago

0.0.20241001

10 months ago

0.0.20241013

10 months ago

0.0.20241008

10 months ago

0.0.20241007

10 months ago

0.0.20241009

10 months ago

0.0.20240916

11 months ago

0.0.20240917

11 months ago

0.0.20240923

10 months ago

0.0.20240920

10 months ago

0.0.20240903

11 months ago

0.0.20240904

11 months ago

0.0.20240826

11 months ago

0.0.20240827

11 months ago

0.0.20240828

11 months ago

0.0.20240830

11 months ago

0.0.20240728

1 year ago

0.0.20240729

1 year ago

0.0.20240723

1 year ago

0.0.20240602

1 year ago

0.0.20240724

1 year ago

0.0.20240603

1 year ago

0.0.20240604

1 year ago

0.0.20240605

1 year ago

0.0.20240721

1 year ago

0.0.20240722

1 year ago

0.0.20240619

1 year ago

0.0.20240616

1 year ago

0.0.20240730

1 year ago

0.0.20240731

1 year ago

0.0.20240610

1 year ago

0.0.20240611

1 year ago

0.0.20240628

1 year ago

0.0.20240625

1 year ago

0.0.20240621

1 year ago

0.0.20240520

1 year ago

0.0.20240529

1 year ago

0.0.20240527

1 year ago

0.0.20240528

1 year ago

0.0.20240521

1 year ago

0.0.20240809

12 months ago

0.0.20240804

12 months ago

0.0.20240805

12 months ago

0.0.20240806

12 months ago

0.0.20240819

12 months ago

0.0.20240818

12 months ago

0.0.20240812

12 months ago

0.0.20240813

12 months ago

0.0.20240814

12 months ago

0.0.20240709

1 year ago

0.0.20240707

1 year ago

0.0.20240708

1 year ago

0.0.20240823

11 months ago

0.0.20240820

12 months ago

0.0.20240821

11 months ago

0.0.20240716

1 year ago

0.0.20240712

1 year ago

0.0.20240715

1 year ago

0.0.20240710

1 year ago

0.0.20240517

1 year ago

0.0.20240503

1 year ago

0.0.20240501

1 year ago

0.0.20240430

1 year ago

0.0.20240429

1 year ago

0.0.20240427

1 year ago

0.0.20240424

1 year ago

0.0.20240423

1 year ago

0.0.20240422

1 year ago

0.0.20240420

1 year ago

0.0.20240417

1 year ago

0.0.20240415

1 year ago

0.0.20240412

1 year ago

0.0.20240409

1 year ago

0.0.20240405

1 year ago

0.0.20240403

1 year ago

0.0.20240402

1 year ago

0.0.20240401

1 year ago

0.0.20240329

1 year ago

0.0.20240328

1 year ago

0.0.20240326

1 year ago

0.0.20240322

1 year ago

0.0.20240320

1 year ago

0.0.20240319

1 year ago

0.0.20240318

1 year ago

0.0.20240317

1 year ago

0.0.20240312

1 year ago

0.0.20240306

1 year ago

0.0.20240305

1 year ago

0.0.20240304

1 year ago

0.0.20240303

1 year ago

0.0.20240226

1 year ago

0.0.20240227

1 year ago

0.0.20240225

1 year ago

0.0.20240220

1 year ago

0.0.20240221

1 year ago

0.0.20240219

1 year ago

0.0.20240213

1 year ago

0.0.20240211

1 year ago

0.0.20240207

1 year ago

0.0.20240206

1 year ago

0.0.20240204

1 year ago

0.0.20240131

2 years ago

0.0.20240130

2 years ago

0.0.20240126

2 years ago

0.0.20240123

2 years ago

0.0.20240119

2 years ago

0.0.20240115

2 years ago

0.0.20240110

2 years ago

0.0.20240109

2 years ago

0.0.20240105

2 years ago

0.0.20240103

2 years ago

0.0.20240102

2 years ago

0.0.20231212

2 years ago

0.0.20231210

2 years ago

0.0.20231205

2 years ago

0.0.20231204

2 years ago

0.0.20231203

2 years ago

0.0.20231128

2 years ago

0.0.20230817

2 years ago

0.0.20231106

2 years ago

0.0.20230810

2 years ago

0.0.20231105

2 years ago

0.0.20231108

2 years ago

0.0.20231107

2 years ago

0.0.20230814

2 years ago

0.0.20230815

2 years ago

0.0.20231113

2 years ago

0.0.20231112

2 years ago

0.0.20231114

2 years ago

0.0.20230808

2 years ago

0.0.20230926

2 years ago

0.0.20230927

2 years ago

0.0.20230806

2 years ago

0.0.20230809

2 years ago

0.0.20230920

2 years ago

0.0.20230803

2 years ago

0.0.20230801

2 years ago

0.0.20230923

2 years ago

0.0.20230802

2 years ago

0.0.20231101

2 years ago

0.0.20230719

2 years ago

0.0.20230718

2 years ago

0.0.20230711

2 years ago

0.0.20231127

2 years ago

0.0.20231006

2 years ago

0.0.20230712

2 years ago

0.0.20230830

2 years ago

0.0.20230831

2 years ago

0.0.20230716

2 years ago

0.0.20230713

2 years ago

0.0.20231011

2 years ago

0.0.20231015

2 years ago

0.0.20230829

2 years ago

0.0.20230708

2 years ago

0.0.20230706

2 years ago

0.0.20230821

2 years ago

0.0.20230822

2 years ago

0.0.20230825

2 years ago

0.0.20230704

2 years ago

0.0.20230823

2 years ago

0.0.20230824

2 years ago

0.0.20231001

2 years ago

0.0.20231003

2 years ago

0.0.20231002

2 years ago

0.0.20231004

2 years ago

0.0.20230731

2 years ago

0.0.20231031

2 years ago

0.0.20231030

2 years ago

0.0.20231018

2 years ago

0.0.20231017

2 years ago

0.0.20230723

2 years ago

0.0.20230720

2 years ago

0.0.20230726

2 years ago

0.0.20230727

2 years ago

0.0.20230724

2 years ago

0.0.20231023

2 years ago

0.0.20231022

2 years ago

0.0.20231025

2 years ago

0.0.20231024

2 years ago

0.0.20231027

2 years ago

0.0.20230917

2 years ago

0.0.20230919

2 years ago

0.0.20230910

2 years ago

0.0.20230913

2 years ago

0.0.20230911

2 years ago

0.0.20230912

2 years ago

0.0.20230906

2 years ago

0.0.20230629

2 years ago

0.0.20230628

2 years ago

0.0.20230901

2 years ago

0.0.20230627

2 years ago

0.0.20230626

2 years ago

0.0.20230612

2 years ago

0.0.20230613

2 years ago

0.0.20230614

2 years ago

0.0.20230615

2 years ago

0.0.20230620

2 years ago

0.0.20230607

2 years ago

0.0.20230608

2 years ago

0.0.20230601

2 years ago

0.0.20230524

2 years ago

0.0.20230523

2 years ago

0.0.20230605

2 years ago

0.0.20230606

2 years ago

0.0.20230531

2 years ago

0.0.20230530

2 years ago

0.0.20230511

2 years ago

0.0.20230517

2 years ago

0.0.20230518

2 years ago

0.0.20230515

2 years ago

0.0.20230516

2 years ago

0.0.20230521

2 years ago

0.0.20230509

2 years ago

0.0.20230502

2 years ago

0.0.20230503

2 years ago

0.0.20230621

2 years ago

0.0.20230622

2 years ago

0.0.20230429

2 years ago

0.0.20230507

2 years ago

0.0.20230504

2 years ago

0.0.20230510

2 years ago

0.0.20230412

2 years ago

0.0.20230413

2 years ago

0.0.20230418

2 years ago

0.0.20230419

2 years ago

0.0.20230416

2 years ago

0.0.20230301

2 years ago

0.0.20230420

2 years ago

0.0.20230326

2 years ago

0.0.20230404

2 years ago

0.0.20230402

2 years ago

0.0.20230405

2 years ago

0.0.20230328

2 years ago

0.0.20230406

2 years ago

0.0.20230329

2 years ago

0.0.20230330

2 years ago

0.0.20230410

2 years ago

0.0.20230411

2 years ago

0.0.20230315

2 years ago

0.0.20230316

2 years ago

0.0.20230314

2 years ago

0.0.20230319

2 years ago

0.0.20230322

2 years ago

0.0.20230323

2 years ago

0.0.20230321

2 years ago

0.0.20230425

2 years ago

0.0.20230304

2 years ago

0.0.20230228

2 years ago

0.0.20230302

2 years ago

0.0.20230424

2 years ago

0.0.20230226

2 years ago

0.0.20230308

2 years ago

0.0.20230309

2 years ago

0.0.20230427

2 years ago

0.0.20230307

2 years ago

0.0.20230216

2 years ago

0.0.20230214

2 years ago

0.0.20230215

2 years ago

0.0.20230223

2 years ago

0.0.20230201

3 years ago

0.0.20230202

2 years ago

0.0.20230221

2 years ago

0.0.20230222

2 years ago

0.0.20230129

3 years ago

0.0.20230203

2 years ago

0.0.20230131

3 years ago

0.0.20230212

2 years ago

0.0.20230126

3 years ago

0.0.20230125

3 years ago

0.0.20230124

3 years ago

0.0.20230123

3 years ago

0.0.20230119

3 years ago

0.0.20230118

3 years ago

0.0.20230117

3 years ago

0.0.20230112

3 years ago

0.0.20230111

3 years ago

0.0.20230110

3 years ago

0.0.20230109

3 years ago

0.0.20230105

3 years ago