In [3]:
%matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr_html', True)
import seaborn as sns #sets up styles and gives us more plotting options
In [4]:
# Time period 1st Jan - 30th April (arbitrary )
# API credentials
# Email address 705762800217-compute@developer.gserviceaccount.com
# Key IDs 948ee8e2a420ef14a5d5a29bd35104fe2f1e6ed4
In [5]:
# open file. It is requested via API explorer using request parameters:
#Account: Skein.co
#Property: Skein.co
#View: Skein.co - Report
#ids: ga:93735856
#start-date: 2017-02-01
#end-date: 2017-04-30
#metrics
#ga:sessions
#dimensions
#ga:eventAction
In [6]:
# Open file
events= pd.read_csv('skein_data/Skein_tags.csv')
# rename columns
events.columns=['Events','Sessions']
# group by events
events = events.set_index('Events')
events
Out[6]:
In [7]:
#count rows
df=pd.DataFrame(events)
total_rows=len(df.axes[0])
print(total_rows)
In [8]:
#checking the count of tags
if total_rows < 5:
result = print("Set tags to enable more user analytics features.")
else:
result = True
result
In [9]:
# open file. It is requested via API explorer using request parameters:
#Account: Skein.co
#Property: Skein.co
#View: Skein.co - Report
#ids: ga:93735856
#start-date: 2017-02-01
#end-date: 2017-04-30
#metrics
#ga:goal1Completions
#ga:goal2Completions
#ga:goal3Completions
#ga:goal4Completions
In [11]:
# Open file
goals= pd.read_csv('skein_data/Skein_goals_tags.csv')
goals
Out[11]:
In [14]:
#count rows
df=pd.DataFrame(goals)
total_goals=len(df.axes[1])
print(total_goals)
In [15]:
Out[15]:
In [17]:
print(d % 'goals defined')
In [ ]: