Skip to main content

Streamlit component that allows you to integrate Google Analytics by tag and send events to Google Analytics

Project description

Streamlit Google Analytics Tag (gtag)

A Streamlit component that allows you to integrate Google Analytics by tag and send events to Google Analytics.

Installation

pip install streamlit-google-analytics-tag

Usage

Important: The package name is streamlit-google-analytics-tag but the module name is streamlit_gtag.

import streamlit as st
from streamlit_gtag import st_gtag  # Note: import from streamlit_gtag, not streamlit_google_analytics_tag

# Initialize Google Analytics
st_gtag(
    gtag_id="GA_MEASUREMENT_ID",
    config={
        "send_page_view": True
    }
)

# Send custom events
st_gtag(
    event="custom_event",
    parameters={
        "event_category": "engagement",
        "event_label": "button_click"
    }
)

Features

  • Easy integration with Google Analytics 4
  • Support for custom events
  • Streamlit-native component
  • Lightweight and fast

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

streamlit_google_analytics_tag-1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

streamlit_google_analytics_tag-1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_google_analytics_tag-1.1.tar.gz.

File metadata

File hashes

Hashes for streamlit_google_analytics_tag-1.1.tar.gz
Algorithm Hash digest
SHA256 aa15b6b75ea57fe08bf00277ccfb4e78f33059348d6ca4a061ee3836bc87db67
MD5 ba2e95f14ac20bfcc95fadd1a405899c
BLAKE2b-256 8eb1f861c6e760dd24fc35f3d016c91adbfc3b5ac9be7975bda61855acf4dd28

See more details on using hashes here.

File details

Details for the file streamlit_google_analytics_tag-1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_google_analytics_tag-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 571dd68f43b26cf8f8cd21793da504fa22da03a64434d7fd3dbcb44b45f899cc
MD5 003b7deaa7b7c347e751a788b2e27fbc
BLAKE2b-256 7bcc5efc38f1c7aa9465db359c023e2c80e7ce14431d2ba28fb0018271d30979

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