Skip to main content

Utilities for Google Analytics, Google Analytics 4, Google Sheets, Search Console and Google Cloud Platform.

Project description

megaton

Megaton は Google Analytics 4、Google Search Console、Google Sheets、BigQuery を Notebook から短いコードで扱う ためのツールです。分析の試行錯誤を速く回すことを重視し、Notebook 向けの UX に特化しています。

コア概念

  • 結果オブジェクト: SearchResult / ReportResult によるメソッドチェーン
  • シンプルな流れ: 開く → 期間設定 → 取得 → 保存
  • Notebook 前提: 途中結果の確認を前提にした設計

クイックスタート

from megaton.start import Megaton

mg = Megaton("/path/to/service_account.json")
mg.report.set.dates("2024-01-01", "2024-01-31")
mg.report.run(d=["date", "eventName"], m=["eventCount"])

mg.open.sheet("https://docs.google.com/spreadsheets/d/...")
mg.save.to.sheet("_ga_data", mg.report.data)

もう少し実用的な例

# 複数サイトの Search Console データを一括取得して整形
result = (mg.search.run.all(
    sites,
    dimensions=['query', 'page'],
    item_key='clinic',
)
    .categorize('query', by=query_map)
    .categorize('page', by=page_map))

mg.save.to.sheet('_query', result.df, sort_by='impressions')
mg.upsert.to.csv(result.df, filename='query_master', keys=['clinic', 'query', 'page'], include_dates=False)

インストール

# PyPI 公開版
pip install megaton

# 最新版(GitHub)
pip install git+https://github.com/mak00s/megaton.git

ドキュメント

変更履歴

ライセンス

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

megaton-1.0.0.tar.gz (127.4 kB view details)

Uploaded Source

Built Distribution

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

megaton-1.0.0-py3-none-any.whl (92.0 kB view details)

Uploaded Python 3

File details

Details for the file megaton-1.0.0.tar.gz.

File metadata

  • Download URL: megaton-1.0.0.tar.gz
  • Upload date:
  • Size: 127.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for megaton-1.0.0.tar.gz
Algorithm Hash digest
SHA256 029bea66bbcc851fa8457cfdf1054ce8b845878e1e69ec7e5da841330877e906
MD5 7e0c38968362d7658f61e2437cddb796
BLAKE2b-256 04ad3dea3abe3085f72183d37798f936f5f17c85066bc08be3e834dfb85bb3f3

See more details on using hashes here.

File details

Details for the file megaton-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: megaton-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 92.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for megaton-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7a66b02217a2f9f32d581580bbcdcc8dc2822a5e17bfd4a1651c92e8967ba4b
MD5 a5cf4d0a1dee7b2720c62d4a3ce494d6
BLAKE2b-256 5c817f7f64207c2e2c74a4d8b68a80f4530e3e182db980223531b1e584557c4d

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