micheleriva

micheleriva

Hello everybody!
I’m trying to implement the official Google Analytics Reporting API Elixir package (elixir-google-api/clients/analytics_reporting at main · googleapis/elixir-google-api · GitHub) in a personal project, but I can not find any working example out there.
While it’s well documented in the code, it’s still not clear how to properly use those APIs.

Have you ever tried to implement those APIs? Do you know where can I read a working example?
Thanks a lot!

Showing Posts 1 to 2

darkblueorange

darkblueorange

Hello
Probably a bit late, but I also ran into little documentation / examples.

Here is something that works for me :

...
@googleViewId "ga:XXXXXX"

def google_analytics_authenticate() do
    {:ok, google_bearer_token} = Goth.fetch(YourAppName.Goth)
    google_bearer_token.token
end

def google_analytics_query() do
    conn =
      authenticate()
      |> GoogleApi.AnalyticsReporting.V4.Connection.new()

    {:ok, %Model.GetReportsResponse{reports: [%Model.Report{} = resp]}} =
      conn
      |> Reports.analyticsreporting_reports_batch_get(
        body: %Model.GetReportsRequest{
          reportRequests: [
            %Model.ReportRequest{
              viewId: @googleViewId,
              dateRanges: [
                %Model.DateRange{
                  startDate: "2021-10-05",
                  endDate: "2021-10-22"
                }
              ],
              dimensions: [
                %Model.Dimension{
                  name: "ga:browser"
                },
                %Model.Dimension{
                  name: "ga:sessionDurationBucket"
                }
              ],
              metrics: [%Model.Metric{expression: "ga:users"}]
            }
          ]
        }
      )
    resp
end

waheed-fullstack-eng

waheed-fullstack-eng

I’m also implementing google analytics API but I’m not able to do this. would you please help in this scenario.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews