Data Engineering tool for accessing Adobe CJA Reporting API
Project description
py2adobe_reporting
A Python wrapper for Adobe Customer Journey Analytics (CJA) Reporting API that enables analysts to easily extract and analyze data programmatically.
Features
- Time Series Reports - Daily and monthly aggregated metrics
- Multi-Metric Analysis - Pull up to 5 metrics in a single report
- Dimension Breakdowns - Break down metrics by multiple dimensions
- Top Items Analysis - Get top 10 dimension items with optional search
- Pagination Support - Handle large datasets with automatic pagination (up to 50,000 rows per page)
- Server-to-Server Authentication - Secure OAuth 2.0 authentication
Installation
pip install py2adobe_reporting
Or install from source:
git clone https://github.com/jaytmii/py2adobe_reporting_package.git
cd py2adobe_reporting_package
pip install -e .
Requirements
- Python >= 3.10
- Adobe CJA API credentials (OAuth 2.0 Server-to-Server)
Quick Start
1. Set Up Authentication
Create a JSON configuration file with your Adobe credentials:
{
"client_secret": "your-client-secret",
"defaultHeaders": {
"x-api-key": "your-api-key",
"x-gw-ims-org-id": "your-org-id"
},
"company_id": "your-company-id",
"scopes": "api_scopes",
"ims_host": "ims",
"token_url": "token_url"
}
2. Authenticate
from py2adobe_reporting.auth import s2s_auth
# Authenticate and get environment object
env = s2s_auth("path/to/config.json")
3. Generate Headers
from py2Adobe_reporting.auth import cja_oauth_headers
# Create headers for API calls
headers = cja_oauth_headers("path/to/config.json", env.token)
4. Pull a Report
from py2adobe_reporting.cja_functions.reporting_management import Reporting
# Initialize reporting class
reporting = Reporting()
# Get daily time series report
df = reporting.daily_time_series_report(
headers=headers,
data_view_id="your-data-view-id",
start_date="2024-01-01",
end_date="2024-01-31",
metric="metrics/visits"
)
print(df.head())
Available Functions
Time Series Reports
monthly_time_series_report()- Month-level aggregated metricsdaily_time_series_report()- Day-level aggregated metrics
Multi-Dimensional Reports
five_metrics_report()- Pull 5 metrics with a dimensionbreakdown_report()- Break down a metric by two dimensionsget_all_rows_report()- Get all rows for custom request body
Utility Functions
get_single_call_report()- Single API call with custom bodyget_total_table_rows()- Get row count for a tableget_total_table_pages()- Calculate total pages neededget_top_ten_dimension_items()- Get top 10 items for a dimension
Documentation
For detailed function parameters and examples, see:
Example Use Cases
Get Daily Visits
df = reporting.daily_time_series_report(
headers=headers,
data_view_id="your-data-view-id",
start_date="2024-01-01",
end_date="2024-01-31",
metric="metrics/visits"
)
Get Monthly Visits
df = reporting.monthly_time_series_report(
headers=headers,
data_view_id="dv_123",
start_date="2024-01-01",
end_date="2024-12-31",
metric="metrics/visits"
)
Breakdown by Multiple Dimensions
df = reporting.breakdown_report(
headers=headers,
data_view_id="dv_123",
start_date="2024-01-01",
end_date="2024-01-31",
dimension="variables/page",
metric="metrics/visits",
dim_rows_per_page=50,
breakdown_dim="variables/browser",
breakdown_rows_per_page=50
)
Search for Dimension Items
df = reporting.get_top_ten_dimension_items(
headers=headers,
data_view_id="dv_123",
start_date="2024-01-01",
end_date="2024-01-31",
dimension="variables/page",
search_type="contains",
contains_term="( CONTAINS 'product' )"
)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
James Mitchell - jaytmii@gmail.com
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py2adobe_reporting-0.0.15.tar.gz.
File metadata
- Download URL: py2adobe_reporting-0.0.15.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf693d6e6c583ddc61eb831d78ca40eb7d214b490b26e1a3d244126c1c08198d
|
|
| MD5 |
5903afb2ffdc86002fe09cfc32718a76
|
|
| BLAKE2b-256 |
e7202b028498cddf378be19cd089dc83d52a3bafda809cfaa073a7a1f15f905e
|
File details
Details for the file py2adobe_reporting-0.0.15-py3-none-any.whl.
File metadata
- Download URL: py2adobe_reporting-0.0.15-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64cc0e739ac394373bb20249adcd6d4cbfb4e1c61c37728f8e6f5fb41a11ad7c
|
|
| MD5 |
4cbbb499a1bf5e0fa5d88d78d3294080
|
|
| BLAKE2b-256 |
ec1c95d0ce1a36a853b6693d317e2cadcfd5072f927f06b6e9afeceebdb579f3
|