Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ayush
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...

 

  • 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
v-danhe-msft
Employee
Employee

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.

View solution in original post

3 REPLIES 3
v-danhe-msft
Employee
Employee

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.

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

 

Regards,

Ayush

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.