This release is a pre-release and may not be stable for production use.
zfl-analytics
PythonのWebフレームワークであるDjangoで開発した分析アプリです。
現在の仕様はGoogleアナリティクスのデータに特化した分析アプリとなっています。
目次
使い方
以下のバージョンでの使用を検討してください。
| 名前 | バージョン |
|---|---|
| Python | 3.7.0 |
| Django | 2.2.5 |
$ pip install zfl-analytics
Djangoプロジェクトの設定ファイルを開いて「INSTALLED_APPS」にアプリを設定します。
# settings.py
...
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'analytics', # 追加
]
Djangoプロジェクトのパス設定ファイルを開いてアプリのパスを設定します。
# urls.py
...
urlpatterns = [
path('admin/', admin.site.urls),
...
path('', include('analytics.urls')) # 追加
]
データベースを初期化して管理画面に入る為のスーパーユーザーを作成しDjangoプロジェクトを起動します。
$ python3 manage.py migrate
$ python3 manage.py createsuperuser
$ python3 manage.py runserver
管理画面にアクセスして、「Googleアナリティクス4の構成」を追加してください。
この構成はデータを更新する際にGoogleアナリティクス4のAPIを使用するときに必要です。
※APIキーは環境変数に設定します。
ログインした状態でアプリのページにアクセスすると、ナビゲーションバーに「設定」マークと「更新」マークが表示されます。
更新ボタンをクリックすると、Googleアナリティクス4のAPIを通じてデータを取得します。
データを取得する範囲は、「Googleアナリティクス4の構成」の「days_ago」で設定されている値の範囲です。「7」であれば過去7日間のデータを取得することになります。注:現在取得できる範囲は過去30日間までとなっています。
コマンドによるデータの更新は以下の方法です。
# 設定が完了していない場合
$ python3 manage.py update_analyticsdata
GoogleAnalytics4の設定が完了しておりません
# 設定が完了している場合
$ python3 manage.py update_analyticsdata
アナリティクスアプリのデータベース更新完了
テンプレートファイルの設定は管理画面から行えます。
Djangoプロジェクトの直下に「templates/base.html」が存在していれば自動的に読み込まれますが、存在していなかったりファイル名が「base.html」でない場合は独立したHTMLファイルを使用します。
それらベースのテンプレートファイルの設定やBootstrapのグリッドシステムの設定は「アナリティクスアプリの設定」から行えます。
License
zfl-analytics is distributed under the terms of the MIT license.
Metadata
Release files for zfl-analytics 0.0.7a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zfl_analytics-0.0.7a0.tar.gz | 18.9 kB | Without provenance | Details for zfl_analytics-0.0.7a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zfl_analytics-0.0.7a0-py3-none-any.whl | Python 3 | none | any | Details for zfl_analytics-0.0.7a0-py3-none-any.whl |
Total release size: 54.6 kB
Release files / zfl_analytics-0.0.7a0.tar.gz
| Download URL | zfl_analytics-0.0.7a0.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f020f2f417145ed5b79d9afbbff13e8717ebf2855f9b9d619c724c1714f0a92f
|
|
BLAKE2b-256 checksum How to use checksums |
eeb3135a4d14dea950fb48f80e3bd57e380be0a42f25c8827cdce05c8321a895
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.24.1
|
Release files / zfl_analytics-0.0.7a0-py3-none-any.whl
| Download URL | zfl_analytics-0.0.7a0-py3-none-any.whl |
|---|---|
| Size | 35.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39deecf8d58464b6ea970280a668988d870a993c0a7e42763f0e5e8dc8c974c0
|
|
BLAKE2b-256 checksum How to use checksums |
abd7b039f4867bdb93d71d2e0d3426f658ca49e3399e4cb258cf4d69df67b9cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.24.1
|
Security for zfl-analytics 0.0.7a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.