cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ayush Frequent Visitor
Frequent Visitor

M Language code to connect Google Analytics api directly to Power BI

This program is written on M# language and it is used for retrieving data from Google Analytics API directly to Power BI                           

Here is the link of Dashboard which I am using -  
https://github.com/maxim-uvarov/PQGoogleAnalytics/files/647569/PQGoogleAnalytics2.02.zip

 

After that, I am following steps

  • Open the settings of Power BI, go to the "Privacy" tab, choose the setting "Always ignore the Privacy Level settings".
  • Open the link below in your browser, hit the "Allow" button and copy the given token (I changed client code to my GA account client code) 

https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/analytics.readonly&r...Smiley SurprisedSmiley Surprised

 

  • Open Power Query by hitting "Edit Queries" button on the "Home" tab on the ribbon of Power BI.
  • Paste the token from the step 1 into "authToken" parameter.
  • Go to "getRefreshToken" query and Copy the token from your preview window.
  • Paste the token from the step 5 into "refreshToken" parameter.

 

After pasting the “refreshToken” I clicked “close and apply” button in the power BI, I am getting following error

 PBI.PNG

I tried other options(Windows,A PI, Basic etc.) for authentication but not able to connect.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: M Language code to connect Google Analytics api directly to Power BI

Hi @ayush,

Based on your steps, I could nof figure out what you want to get in your advanced editor:

  1. The token I got from the link means what? I saw you have used it as parameter but I could not figure out how to use.1.PNG
  2. The 'code' and 'url' you written in the advanced editor seem stitching many parts of code, could you please offer more information about it? And the app_crendentials stands for what2.PNG

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 REPLIES 3
Community Support Team
Community Support Team

Re: M Language code to connect Google Analytics api directly to Power BI

Hi @ayush,

Based on your steps, I could nof figure out what you want to get in your advanced editor:

  1. The token I got from the link means what? I saw you have used it as parameter but I could not figure out how to use.1.PNG
  2. The 'code' and 'url' you written in the advanced editor seem stitching many parts of code, could you please offer more information about it? And the app_crendentials stands for what2.PNG

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
ayush Frequent Visitor
Frequent Visitor

Re: M Language code to connect Google Analytics api directly to Power BI

@v-danhe-msft Thanks for the response. Got the results.

 

Regards,

Ayush

Community Support Team
Community Support Team

Re: M Language code to connect Google Analytics api directly to Power BI

Hi @ayush,

It's pleasant that your problem has been solved, could you please mark a reply as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.