Custom GA4 Power BI Connector – Open Source

IMG-20230128-WA0009_1240x600

looking for alternative to Biq Query, yep me too, so I built a connector for the new API.

So, I started working in GA4 earnestly mid last year. The first bit was easy, getting data into GA4, the latter bit of getting data back out and in to a place I could swing it around in a way I was comfortable was going to take some more work.

Options

If you are a user of Power BI or equivalent you may have felt this same pain. They don’t have native API connectors yet, so our choices were limited to using BigQuery, a paid connector solution (nope!) or rolling our own data connector. With a lot of help from my coding buddies I’ve chosen the latter as I want to be a bit more flexibility with my queries.

I’ve decided to go it myself for now and build my own custom connector for Power BI. You are welcome you to join me in giving it a go. It’s not a perfect solution, it won’t currently refresh via PBI online without modification for example but, as a stop gap, it’s ok.Ā  It’s also totally without warranty, support or liability šŸ˜‰

Saying that, take it slowly, read the instructions first. I won’t be held responsible if it goes wrong but I will try to support you to get it working where I can.

How You Get It Working

I’m splitting this across a few posts as there are a few things to care off.

Also the API is capable of doing a couple of neat things, such as pivot charts and funnels. let me know in the comments or via twitter which you would like me to add first.

If you have already done the setup and are just looking for the setup file it’s here

GA4PowerBIConnector 0.72

If you want to help contribute or review the code the GitHub is here

Github.com/GavinBrogan/GA4PowerBIConnector

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

photo credit Graeme BroganĀ 

Comments ( 8 )

  • Jean-Remy Duboc
    Jean-Remy Duboc

    This is extremely useful Gavin !
    Is the source code in GitHub ? I’d love to learn and contribute.

    • Gavin Brogan
      Gavin Brogan

      Yeah it is
      Github.com/GavinBrogan/GA4PowerBIConnector

  • Kim
    Kim

    Hello,

    I’ve used your custom connector and it worked like a charm! Thank you for sharing this great posts.
    Do you have any experience of using this custom connector for Power BI Service?
    I had no problem logging in with the GA credential in Power BI Desktop but it’s causing the error in Power BI Service Gateway for refreshing the report.

    • Gavin Brogan
      Gavin Brogan

      Think you have to install it on the gateway. Will need a wee tweak to the code

      // Data Source Kind description
      GA4PowerBIConnector = [
      // TestConnection is required to enable the connector through the Gateway
      TestConnection = (dataSourcePath) => { ā€œNavigationTable.Simpleā€ },
      Authentication = [
      OAuth = [
      StartLogin = StartLogin,
      FinishLogin = FinishLogin
      ]
      ],
      Label = Extension.LoadString(ā€œGA4 Data APIā€)];

      code provided by a user Sander Verbruggen

      • Anne
        Anne

        Hi Gavin,
        do you have a bit more information on how to do this? I tried googling but didn’t get very far.

  • Manuel Alejandro
    Manuel Alejandro

    Hello!

    I have used your connector and it works for me, I have tried so far with three GA4 properties, one of them measures the traffic of web pages from Colombia and Brazil, the other is from Mexico and it is the only one that I have found an error with. Do you know what it is for?

    Expression.Error: No se encontrĆ³ el campo ‘rowCount’ del registro.
    Detalles:
    dimensionHeaders=[List]
    metricHeaders=[List]
    metadata=
    currencyCode=MXN
    timeZone=America/Mexico_City
    kind=analyticsData#runReport

  • Michael Craven
    Michael Craven

    Hi Gavin,

    We’re currently using Power BI to report on GA data and found your connector so gave it a try, it looks like it works but not for some custom columns which we have created for the site, do you have any ideas on how we would go about pulling that data in to Power BI using your connector?

    • Sam Carter
      Sam Carter

      Hi Michael, are you trying to add custom dimensions to your query? Just add them within the dimension parameter as “customEvent:[custom dimension name]” (or customUser if its user scoped dimension).

Leave a Comment