Skip to content

Instantly share code, notes, and snippets.

@MarkEdmondson1234
Last active August 29, 2015 14:08
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 MarkEdmondson1234/b722aba26f8ca7d49379 to your computer and use it in GitHub Desktop.
Save MarkEdmondson1234/b722aba26f8ca7d49379 to your computer and use it in GitHub Desktop.
Get the GA data for a profile
## pull in the GA data
# get list of profiles
profiles <- ga$getProfiles()
# View the profiles table, and pick the profile you want and put in the profile ID below
UA <- "XXXXXXX"
# choose the dates you want to pull in data for
date_before = "2014-09-01"
date_after = "2014-10-01"
# pull out traffic - in this case SEO visits by date
gadata <- ga$getData(ids = UA,
start.date = date_before,
end.date = date_after,
metrics = "ga:visits",
dimensions = "ga:date",
sort = "ga:date", filters = "ga:medium==organic", segment = "",
start = 1, max = 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment