I have a Google analytics Oauth 2.0 REST API query. I was able to successfully retrieve the ItemId dimension, and itemsViewedInList and customItem:dream_program_vocation_adjective metrics. What's currently happening is I have two display table components right now:
Table 1 - google analytics
Columns: Program ID, itemsViewedInList, and customItem:dream_program_vocation_adjective
Table 2 - postgresql query (from our database)
Columns: Program ID, number of enrollments
I would like to use the result in a postgresql query to match the program_id in my sql database to the ItemId from google analytics and I would like to display the combined query result in one table component.
So it should look like:
Columns: Program ID, itemsViewedInList, and customItem:dream_program_vocation_adjective, number of enrollments
Unfortunately, I can't use currentsourcerow in my postgresql query but instead just selectedRow so what happens is every time I click on a row that's the time that it will display the number of enrolments. However, I want the table to the corresponding number of enrollments per program ID.
I am aware that there is a way to transform the result of my google analytics REST API and that could potentially help me in this scenario. Unfortunately, I am a beginner in all of this so I'm not sure how to do that yet. For more context here are the queries.
GA oauth:
{"dimensions":[{"name":"itemId"},{"name":"customItem:dream_program_vocation_adjective"}],"metrics":[{"name":"itemsViewedInList"}],"dateRanges":[{"startDate":"30daysAgo","endDate":"today"}],"metricAggregations":["TOTAL"]}
postegreSQL:
select COUNT(*) from enrollment_item where program_id = {{ table2.selectedRow.dimensionValues[0].value }} and status = 'LEAD'
Looking forward to your suggestions!