marineenergy / www

Marine hydrokinetic energy & environmental compliance, website
https://marineenergy.app
MIT License
1 stars 1 forks source link

turn on Google Analytics for website #28

Closed bbest closed 2 years ago

bbest commented 1 week ago

Here's what Google Analytics looks like when logged in:

And visiting the Admin (lower left gear), Account access management:

bbest commented 1 week ago

And here are the Python scripts by Jonathan Whiting for downloading the analytics.

Scripts.zip


From: Whiting, Jonathan M Sent: Monday, April 22, 2024 3:48 PM Subject: Download Google Analytics Scripts

Attached are the Python scripts that I created to download analytics. On the detailed scripts, I ran it year-by-year because I was debugging, but you could easily loop over a span of years if desired.

Here are some steps:

  1. Set Up Google Cloud Project and Enable APIs:
    • Go to the Google Cloud Console: https://console.cloud.google.com/.
    • Create a new project or select an existing project.
    • Enable the Google Analytics Reporting API for your project.
    • Create credentials (OAuth 2.0 client ID) for your project. Choose "Other" as the application type.
  2. pip install --upgrade google-api-python-client
  3. Update KEY_FILE_NAME, SITE, and VIEW_ID.

The summary file lists daily counts, while the detail files show each instance of users or pageviews.

bbest commented 1 week ago

See also, the issue for turrning on analytics for the app, ie shiny.marineenergy.app/report-v2: