googleapis / googleapis/google-api-nodejs-client
type:question I have Question in Google Analytics ( path portion )
- Dominant language
- TypeScript
- Stars
- 12.2k
- Forks
- 2k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 24
Description
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
i get ga:users and ga:sessions using this module
i success in main page (example: www.example.com)
but i failed other page (example: www.example.con/other/path)
how can i get other path users, sessions in this code ??
i put www.example.com in siteUrl value
below code method
```
async getDAU(
siteUrl: string,
startDate: string,
endDate?: string,
): Promise {
await this._jwt.authorize();
const viewId = await this._getPropertyId(siteUrl);
console.log(viewId,"thisviewid");
const params: Params$Resource$Data$Ga$Get = {
auth: this._jwt,
ids: 'ga:' + viewId,
'start-date': startDate,
'end-date': endDate || startDate,
metrics: 'ga:users,ga:sessions',
};
const result = await this._analytics.data.ga.get(params);
return result.data.totalsForAllResults;
}
```
below code is this._getPropertyId() method
```
private async _getPropertyId(siteUrl: string): Promise {
await this._jwt.authorize();
let propertyId = 0;
const params: Params$Resource$Management$Accountsummaries$List = {
auth: this._jwt,
};
const result: any = await this._analytics.management.accountSummaries.list(
params,
);
result.data.items[0].webProperties.forEach((item: any) => {
// console.log(item.websiteUrl)
if (item.websiteUrl === siteUrl) {
propertyId = item.profiles[0].id;
}
});
return Promise.resolve(propertyId);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.