コード例 #1
0
# matplotlib.pyplot
# scipy.stats

# importing python libraries (already installed via UI)
from datetime import datetime
import matplotlib.pyplot as plt
from scipy.stats import mannwhitneyu
from adobe_analytics import Client, ReportDefinition
import pandas as pd
pd.set_option("display.max_columns", None)

# setting client variable with my username and shared secret (from Adobe Analytis user management)
client = Client("username", "shared secret")

# setting suite variable with the global report suite id
suites = client.suites()
suite = suites["fairfaxnz-stuffoverall-production"]

# can be used to return a list of available metrics, dimensions and segments if the code needs to be updated
# print(suite.metrics())
# print(suite.dimensions())
# print(suite.segments())

# running report for top 400 dimensions for 2018-09-01 to 2018-09-15
# dimensions - prop45(Device ID), evar131(AB Testing Segment)
# metrics - visits, page views, event22(Article View)

report_definition = ReportDefinition(
    dimensions=[
        {"id": "prop45", "top": 400},
        {"id": "evar131", "top": 1},
コード例 #2
0
today = date.today()
d1 = str(date(today.year, today.month, today.day) - timedelta(days=7))
d2 = str(date(today.year, today.month, today.day) - timedelta(days=1))
d3 = str(date(today.year, today.month, today.day))

# Authenticate your access to adobe analytics API using unique key ( Ask you Adobe administrator to provide you the unique key against your account)
# organisation name is the name of organisation as per adobe analytics

client = Client('[email protected]:Organisation Name', 'unique Key')

# Remeber, Adobe Analytics takes every aurgument as IDs , not their actual names as per workspace so it is important to know the ID's of all dimentions, segemnts, report suites.

# get the list of report suites with ID's available in organisation and save them to csv file for future references

d = client.suites()
df1 = pd.DataFrame.from_dict(d, orient='index')
df1.to_csv("path" + '.csv', index=True)

# Get the Dimentions of specific report suite

suite = client.suites()['Suite-ID']

seg = suite.dimensions()
df2 = pd.DataFrame.from_dict(seg, orient='index')
df2.head()
df2.to_csv("Path" + "dimentions-suite1" + '.csv', index=False)

# Get the Segments of specific report suite

suite = client.suites()['Suite-ID']