Skip to main content

A simplified Python client for making raw Google Analytics 4 API calls

Project description

Google Analytics Process

A Python library for processing Google Analytics 4 data with built-in data transformations and channel grouping logic.

Installation

pip install Google-Analytic-Process

Quick Start

from ga4_analytics import GA4Processor
from datetime import datetime, timedelta

# Initialize processor
processor = GA4Processor(
    credentials_path="/path/to/your/credentials.json",
    property_id="your_ga4_property_id"
)

# Define date range
end_date = datetime.now().date()
start_date = end_date - timedelta(days=7)

# Fetch and process general report with default dimensions/metrics
df = processor.get_general_report(start_date, end_date)

# Or specify custom dimensions and metrics
custom_dimensions = ["date", "sessionDefaultChannelGroup", "deviceCategory"]
custom_metrics = ["sessions", "totalRevenue", "transactions"]
df_custom = processor.get_general_report(
    start_date, end_date,
    dimensions=custom_dimensions,
    metrics=custom_metrics
)

# For completely custom reports with optional processing
df_raw = processor.get_custom_report(
    start_date, end_date,
    dimensions=custom_dimensions,
    metrics=custom_metrics,
    apply_processing=False  # Get raw data without transformations
)

print(df.head())

Features

  • Easy GA4 API integration
  • Flexible dimensions and metrics - specify your own or use defaults
  • Custom report generation - with optional data processing
  • Built-in data transformations and cleaning
  • Channel grouping and campaign labeling
  • Revenue reallocation logic
  • Email campaign data integration
  • Configurable data formatting

Features in v0.1.0

  • Custom dimensions and metrics in get_general_report()
  • New get_custom_report() method for full flexibility
  • Optional data processing - get raw data or processed data
  • Easy GA4 API integration

Requirements

  • Python 3.8+
  • Google Analytics Data API credentials
  • pandas, numpy, google-analytics-data

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_analytic_process-0.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_analytic_process-0.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file google_analytic_process-0.2.0.tar.gz.

File metadata

  • Download URL: google_analytic_process-0.2.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for google_analytic_process-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9a276bf8a3a1cdaaa54240dc493f2dd866252bc757721ee2946f74e7c1671aaf
MD5 d3aad5d59b11aace04f88d9500a403a6
BLAKE2b-256 74b9d636e8f316a1795cc35ee7d3e0e18addc07ecc0d3939104ffc57a7f59ee4

See more details on using hashes here.

File details

Details for the file google_analytic_process-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_analytic_process-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7addaed1e16c6987279d4ddf2b4b564c471c1072d79d1357e2cb04da77ca7d8a
MD5 0116242f8bf27e0f737a20924fa1f2f1
BLAKE2b-256 59dad94bde9f4f82d7c95cf8cd3f4c4d3ee7352f6b6dafa33a2cb06f11914e3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page