Skip to main content

A Python library for processing Google Analytics 4 data

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.1.0.tar.gz (7.2 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.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: google_analytic_process-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 c8d620200851f41f1cd7f66afd9b6039ed80a8547371792f601ed9ee791a683a
MD5 33c7a3beb47b86011a9b797f45e8e8f7
BLAKE2b-256 4a4e57b8173ad84e851653221cad23ad56b8d8de2f693d93f9c94f345554ac01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for google_analytic_process-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 947d940191a57e494e622add759cbe70ce222488149c87e0da5c16de6e76ada7
MD5 50f831482b9fd5aa26b065d0dd01ee1b
BLAKE2b-256 3a90aaaa92b60577acde8a3a2af1d8833aa6c391e54c643b89fa37e867bc2056

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