I was really excited to read about Dropout as it seemed great for my project. Unfortunately though the documentation is a bit sparse and, in a couple of spots, wrong. These are the steps I took over a few hours messing around with it to get it to work:
(you'll need pip
and virtualenv
installed for this to work)
mkdir dropout; cd dropout
pip install gapy
git clone git@github.com:annapowellsmith/dropout.git
At this point you'll need to do some configuration work: in goals.csv
you should have something like:
service_name,service_id,goal_id,goal_has_funnel
foo,XXXXXX,X,TRUE
The service_id
took me a while to figure out as "your Google Analytics ID" isn't immediately obvious. This is not the UA-XXXXXX-XX
number. Go to Google Analytics, select your property and click Admin. In the third column ("View") there's a link to "View Settings'. In there you'll see a "View ID". This is the number you want.
-
virtualenv ve
-
source ve/bin/activate
-
pip install -r requirements.txt
-
Ignore the
dropout
instructions about configuringgapy
as it turns out you don't need to do anything. -
Definitely ignore this line:
python dropout.py -f [GOALS_FILE] -s [PATH_TO_STORAGE_DB]
After agonising trying to create a storage.db
file, I looked at the source and it turns out the -s
flag is for the SECRETS_PATH
, eg. the directory containing client_secrets.json
.
You can generate this file at the Google Developers Console:
- Create a new Project.
- Once created, add the Analytics API to the Enabled APIs list.
- In "Credentials", click "Create new Client ID".
- Choose "Installed Application" and type should be "Other" (or "Playstation 4" if you're feeling experimental)
- Once it's generated your ID, click the new "Download JSON" button and save this file as
client_secrets.json
(I saved it in the same directory asdropout.py
. - Finally, you can run this:
python dropout.py -f goals.csv -s .
Congratulations – hopefully you now see a console full of delicious data.
Most of the above is now superseded by updates to
dropout
andgapy
's readmes. Hooray for open source! :)