Skip to content

Instantly share code, notes, and snippets.

@mattandrews
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattandrews/438269895c149af0ccd8 to your computer and use it in GitHub Desktop.
Save mattandrews/438269895c149af0ccd8 to your computer and use it in GitHub Desktop.
Getting dropout to work

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 configuring gapy 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 as dropout.py.
  • Finally, you can run this: python dropout.py -f goals.csv -s .

Congratulations – hopefully you now see a console full of delicious data.

@mattandrews
Copy link
Author

Most of the above is now superseded by updates to dropout and gapy's readmes. Hooray for open source! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment