-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google analytics new goals source #2131
base: master
Are you sure you want to change the base?
Google analytics new goals source #2131
Conversation
This pull request is being automatically deployed with Vercel (learn more). pipedream-docs-redirect-do-not-edit – ./docs🔍 Inspect: https://vercel.com/pipedreamers/pipedream-docs-redirect-do-not-edit/9iQCwHYigR2c1FsepBFg1YdbChoM pipedream-docs – ./docs🔍 Inspect: https://vercel.com/pipedreamers/pipedream-docs/39k7pYqQ9c28hJGR48ndqgqcKcwf |
The OAuth authentication is missing some Analytics scopes |
|
export default { | ||
key: "google_analytics-list-goals", | ||
name: "List Goals", | ||
description: "Lists goals to which the user has access", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include a link to the docs for actions:
description: "Lists goals to which the user has access", | |
description: "Lists goals to which the user has access. [See the docs here](https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/goals/list)", |
token: { | ||
propDefinition: [ | ||
analytics, | ||
"token", | ||
], | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think token
is necessary since we have this.$auth.oauth_access_token
.
token: { | |
propDefinition: [ | |
analytics, | |
"token", | |
], | |
}, |
accountId: { | ||
propDefinition: [ | ||
analytics, | ||
"accountId", | ||
], | ||
description: `${analytics.propDefinitions.accountId.description} | ||
Can either be a specific account ID or \`~all\`, which refers to all the accounts that user has access to`, | ||
}, | ||
webPropertyId: { | ||
propDefinition: [ | ||
analytics, | ||
"webPropertyId", | ||
], | ||
description: `${analytics.propDefinitions.webPropertyId.description} | ||
Can either be a specific web property ID or \`~all\`, which refers to all the web properties that user has access to`, | ||
}, | ||
profileId: { | ||
propDefinition: [ | ||
analytics, | ||
"profileId", | ||
], | ||
description: `${analytics.propDefinitions.profileId.description} | ||
Can either be a specific view (profile) ID or \`~all\`, which refers to all the views (profiles) that user has access to`, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accountId
, webPropertyId
, and profileId
should all have async options
that list the accounts, web properties, and profiles that the user has access to. You could have them default to "~all".
startIndex: { | ||
type: "integer", | ||
label: "Start Index", | ||
description: `An index of the first goal to retrieve | ||
Use this parameter as a pagination mechanism along with the max-results parameter`, | ||
optional: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave in maxResults
, but take out startIndex
and handle pagination in the component.
startIndex: { | |
type: "integer", | |
label: "Start Index", | |
description: `An index of the first goal to retrieve | |
Use this parameter as a pagination mechanism along with the max-results parameter`, | |
optional: true, | |
}, |
}, | ||
}, | ||
async run({ $ }) { | ||
let params = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should declare variables as constants whenever we can.
let params = { | |
const params = { |
_getGoalsInstance(token) { | ||
return this._getAnalyticsInstance(token).management.goals; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_getGoalsInstance(token) { | |
return this._getAnalyticsInstance(token).management.goals; | |
}, | |
_getGoalsInstance() { | |
return this._getAnalyticsInstance().management.goals; | |
}, |
async listGoals(token, params) { | ||
return (await this._getGoalsInstance(token).list(params)).data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async listGoals(token, params) { | |
return (await this._getGoalsInstance(token).list(params)).data; | |
async listGoals(params) { | |
return (await this._getGoalsInstance().list(params)).data; |
}, | ||
async run() { | ||
const startIndex = this._getLastGoalId(); | ||
let params = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let params = { | |
const params = { |
"accountId": "~all", | ||
"webPropertyId": "~all", | ||
"profileId": "~all", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have accountId
, webPropertyId
, and profileId
as props in this component? Then the user can select which ones to watch.
"start-index": startIndex, | ||
}; | ||
|
||
let response = await this.analytics.listGoals(null, params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let response = await this.analytics.listGoals(null, params); | |
const response = await this.analytics.listGoals(null, params); |
Thanks @michelle0927 for the review! |
Google Analytics
New Goals | Triggers when a new goal is added.