python adjust
1.0.0
이것은 Adject.com REST API를위한 비공식 파이썬 래퍼입니다. 나는 조정소와 제휴하지 않으며 자신의 위험에 따라 사용하지 않습니다.
이 프로젝트는 Adventy에서 영감을 받았습니다
https://help.adjust.com/en/article/kpi-service의 공식 문서를 참조하십시오
KPI 서비스에 대한 귀하의 액세스는 조정 사용자 계정에 연결되어 있습니다. 각 사용자 계정에는 관련 사용자 토큰이있어 KPI에 대한 액세스를 개별적으로 제어 할 수 있습니다.
계정 설정> 데이터> 사용자 세부 사항 에서 대시 보드에서 자신의 사용자 토큰을 찾을 수 있습니다. 이것은 아래의 인증에 대해 언급 할 사용자 토큰입니다.
pip install python-adjust
액세스 할 수있는 응용 프로그램 목록을 검색합시다
from adjustapi . api import AdjustApi
api = AdjustApi ( 'USER_TOKEN' )
apps = api . list_apps ()
print ( apps [ 0 ]. name , apps [ 0 ]. token , apps [ 0 ]. id )
# Prints something like: "MyTestApp ft5popkfebns com.mytest.app"이것이 KPI API의 작동 방식입니다
kpis_api = api . kpi_service ( trackers = trackers ,
start_date = start_date ,
end_date = end_date ,
countries = countries ,
app_tokens = app_tokens ,
kpis = kpis )
print ( str ( kpis_api . fetch_kpi ()))
# prints: KpiResult(result_parameters=ResultParameters(kpis=['revenue'], start_date=datetime.date(2020, 4, 4), end_date=datetime.date(2020, 5, 4), sandbox=False, countries=['us'], events=None, trackers=[TrackerResultParameters(token='tsrdag', name='Facebook Installs::Expired Attributions', currency=None, has_subtrackers=False)], grouping=['trackers'], period=None, attribution_type='click', utc_offset='00:00', cohort_period_filter=None, day_def=None, attribution_source='dynamic'), result_set={'token': 'thomki', 'name': 'Facebook Installs', 'currency': 'USD', 'trackers': [{'token': 'tsodkg', 'kpi_values': [3627.54]}]})
print ( str ( kpis_api . fetch_events ()))
# prints: KpiResult(result_parameters=ResultParameters(kpis=['revenue'], start_date=datetime.date(2020, 4, 4), end_date=datetime.date(2020, 5, 4), sandbox=False, countries=['us'], events=[EventParameter(name='com.test.subscription.name', token='s6p2ub'), EventParameter(name='event_name', token='eakvze'), EventParameter(name='event.name.2', token='5a6u7u'), EventParameter(name='event_name_3', token='e34v0e')], trackers=[TrackerResultParameters(token='6tcrta', name='Facebook Installs::Expired Attributions', currency=None, has_subtrackers=False)], grouping=['trackers', 'event_types'], period=None, attribution_type='click', utc_offset='00:00', cohort_period_filter=None, day_def=None, attribution_source='dynamic'), result_set={'token': 'thamsi', 'name': 'Facebook Installs', 'currency': 'USD', 'trackers': [{'token': 'tsrdta', 'events': [{'token': 'e6e2v1', 'kpi_values': [1149.77]}, {'token': 'ea3vpe', 'kpi_values': [95.88]}, {'token': 'e34v0e', 'kpi_values': [17.99]}, {'token': 'eovy8e', 'kpi_values': [147.63]}}]}]})
print ( str ( kpis_api . fetch_cohorts ()))
# KpiResult(result_parameters=ResultParameters(kpis=['revenue'], start_date=datetime.date(2020, 4, 4), end_date=datetime.date(2020, 5, 4), sandbox=False, countries=['us'], events=None, trackers=[TrackerResultParameters(token='csodbh', name='Facebook Installs::Expired Attributions', currency=None, has_subtrackers=False)], grouping=['trackers', 'periods'], period='day', attribution_type='click', utc_offset='00:00', cohort_period_filter=None, day_def='24h', attribution_source='dynamic'), result_set={'token': 'chamsh', 'name': 'Facebook Installs', 'currency': 'USD', 'trackers': [{'token': 'cscoth', 'periods': [{'period': '0', 'kpi_values': [109.89]}}]}]})그러나 대부분의 경우 이러한 데이터가 테이블로 필요하므로 Pandas Dataframe으로 검색 할 수 있습니다.
kpis_api = api . kpi_service ( trackers = trackers ,
start_date = start_date ,
end_date = end_date ,
countries = countries ,
app_tokens = app_tokens ,
kpis = kpis )
print ( str ( kpis_api . fetch_kpi ( as_df = True )))
# ' tracker_token tracker_name revenue
# 0 tsrdag Facebook Installs::Expired Attributions 3627.54'자세한 내용은 문서를 확인하십시오.
궁금한 점이 있으면 문제를 추가하거나 저에게 편지를 보내십시오.
TODO : Airflow Hook 및 Advelapi의 연산자에 링크 추가