@maxim_mazurok/gapi.client.businessprofileperformance-v1
v0.2.20260715
Published
TypeScript typings for Business Profile Performance API v1
Readme
TypeScript typings for Business Profile Performance API v1
The Business Profile Performance API allows merchants to fetch performance reports about their business profile on Google. Note - If you have a quota of 0 after enabling the API, please request for GBP API access. For detailed description please check documentation.
Installing
Install typings for Business Profile Performance API:
npm install @types/gapi.client.businessprofileperformance-v1 --save-devTypeScript 6.0+
TypeScript 6.0 changed types to default to []. You must now explicitly list type packages in tsconfig.json:
{
"compilerOptions": {
"types": [
"gapi",
"gapi.auth2",
"gapi.client",
"gapi.client.businessprofileperformance-v1"
]
}
}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://businessprofileperformance.googleapis.com/$discovery/rest?version=v1',
() => {
// now we can use:
// gapi.client.businessprofileperformance
},
);// 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('businessprofileperformance', 'v1', () => {
// now we can use:
// gapi.client.businessprofileperformance
});After that you can use Business Profile Performance API resources:
/*
Returns the values for each date from a given time range that are associated with the specific daily metrics. Note: Only daily data is available. Hourly metrics are not supported. Example request: `GET https://businessprofileperformance.googleapis.com/v1/locations/12345:fetchMultiDailyMetricsTimeSeries?dailyMetrics=WEBSITE_CLICKS&dailyMetrics=CALL_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
*/
await gapi.client.businessprofileperformance.locations.fetchMultiDailyMetricsTimeSeries(
{location: 'location'},
);
/*
Returns the values for each date from a given time range that are associated with the specific daily metric. Note: Only daily data is available. Hourly metrics are not supported. Example request: `GET https://businessprofileperformance.googleapis.com/v1/locations/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
*/
await gapi.client.businessprofileperformance.locations.getDailyMetricsTimeSeries(
{name: 'name'},
);For provenance information see Provenance section on NPM
