{"action":"created","issue":{"url":"https://api.github.com/repos/dpla/platform/issues/50","repository_url":"https://api.github.com/repos/dpla/platform","labels_url":"https://api.github.com/repos/dpla/platform/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/dpla/platform/issues/50/comments","events_url":"https://api.github.com/repos/dpla/platform/issues/50/events","html_url":"https://github.com/dpla/platform/pull/50","id":318088552,"number":50,"title":"Google analytics","user":{"login":"AudreyAltman","id":3615206,"avatar_url":"https://avatars3.githubusercontent.com/u/3615206?v=4","gravatar_id":"","url":"https://api.github.com/users/AudreyAltman","html_url":"https://github.com/AudreyAltman","followers_url":"https://api.github.com/users/AudreyAltman/followers","following_url":"https://api.github.com/users/AudreyAltman/following{/other_user}","gists_url":"https://api.github.com/users/AudreyAltman/gists{/gist_id}","starred_url":"https://api.github.com/users/AudreyAltman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudreyAltman/subscriptions","organizations_url":"https://api.github.com/users/AudreyAltman/orgs","repos_url":"https://api.github.com/users/AudreyAltman/repos","events_url":"https://api.github.com/users/AudreyAltman/events{/privacy}","received_events_url":"https://api.github.com/users/AudreyAltman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-26T15:43:09Z","updated_at":"2018-04-27T12:53:18Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/dpla/platform/pulls/50","html_url":"https://github.com/dpla/platform/pull/50","diff_url":"https://github.com/dpla/platform/pull/50.diff","patch_url":"https://github.com/dpla/platform/pull/50.patch"},"body":"This adds Google Analytics tracking to the API.  It POSTs usage data to a Google Analytics endpoint.\r\n\r\n**Use metrics**\r\nEvery API request that fetches an item or searches for items will POST two messages to Google Analytics.  One records a \"pageview\" and the other records any \"events\" associated with the request.  An \"event\" encapsulates data about the items returned to facilitate usage reporting to hubs.\r\n\r\n**Exception handling**\r\nGoogle Analytics tracking is meant to fail silently, so it will not interfere with the normal functioning of the API.\r\n\r\n**Threads**\r\nGoogle Analytics tracking runs in its own thread so it won't slow down API response time.  I have tested this locally with strategic use of `sleep` statements (see the two commits labeled \"test thread\").  _Is there more rigorous testing we can/should do here?_  Also, I've never used threading in a Rails app before, so please let me know if there's anything I may be overlooking.\r\n\r\n**Logging**\r\nThe logging is currently very verbose to help with testing/debugging, but if this is going to be annoying we can pare it down.\r\n\r\n**Testing/deployment**\r\nTo deploy this, use the following branches of `aws` and `automation`:\r\n* https://github.com/dpla/aws/tree/api-google-analytics\r\n* https://github.com/dpla/automation/tree/api-google-analytics\r\n\r\nThe google analytics dashboard can be found at analytics.google.com.  Select Digital Public Library of America > DPLA API TEST > All Web Site Data in the top left menu.  You can see data being logged in real time if you select the REAL-TIME > Overview or REAL-TIME > Events report from the left sidebar menu.\r\n\r\nIn the development environment, info is logged at `/srv/www/api/var/log/development.log `"},"comment":{"url":"https://api.github.com/repos/dpla/platform/issues/comments/384961363","html_url":"https://github.com/dpla/platform/pull/50#issuecomment-384961363","issue_url":"https://api.github.com/repos/dpla/platform/issues/50","id":384961363,"user":{"login":"markbreedlove","id":5550828,"avatar_url":"https://avatars3.githubusercontent.com/u/5550828?v=4","gravatar_id":"","url":"https://api.github.com/users/markbreedlove","html_url":"https://github.com/markbreedlove","followers_url":"https://api.github.com/users/markbreedlove/followers","following_url":"https://api.github.com/users/markbreedlove/following{/other_user}","gists_url":"https://api.github.com/users/markbreedlove/gists{/gist_id}","starred_url":"https://api.github.com/users/markbreedlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbreedlove/subscriptions","organizations_url":"https://api.github.com/users/markbreedlove/orgs","repos_url":"https://api.github.com/users/markbreedlove/repos","events_url":"https://api.github.com/users/markbreedlove/events{/privacy}","received_events_url":"https://api.github.com/users/markbreedlove/received_events","type":"User","site_admin":false},"created_at":"2018-04-27T12:53:18Z","updated_at":"2018-04-27T12:53:18Z","author_association":"OWNER","body":"Regarding https://github.com/dpla/automation/compare/api-google-analytics, the new variable named `api_google_analytics_tid` may be redundant with `google_analytics_property_id`, which is currently used by the `pss` role and could be used also for this one."}}
{"actor":{"display_login":"markbreedlove"}}