{"action":"created","comment":{"url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/comments/80077652","id":80077652,"diff_hunk":"@@ -0,0 +1,79 @@\n+#' Generic function that will apply a particular analytics\n+#' approach to a vizlab object\n+#'\n+#' @param viz vizlab object or identifier\n+#' @return vizlab object decorated with analytics\n+#' @export\n+analytics <- function(viz) UseMethod(\"analytics\")\n+\n+#' Dispatch to appropriate analytics function\n+#'\n+#' @rdname analytics\n+#' @export\n+analytics.viz <- function(viz) {\n+  viz <- as.analytics(viz)\n+  analytics(viz)\n+}\n+\n+#' Catch analytics calls that have no matching type\n+#'\n+#' @rdname analytics\n+#' @export\n+analytics.analytics <- function(viz) {\n+  warning(\"this analytics type is not yet supported\")\n+}\n+\n+#' Add a trigger for a given element to cause a analytics event\n+#' when it is scrolled to\n+#'\n+#' @importFrom xml2 read_xml xml_has_attr xml_attr xml_attr<-\n+#' @rdname analytics\n+#' @export\n+analytics.scroll <- function(viz) {\n+  required <- c(\"output\")\n+  checkRequired(viz, required)\n+\n+  class <- \"vizScroll\"\n+  html <- read_xml(viz[['output']])\n+  if (xml_has_attr(html, \"class\")) {\n+    xml_attr(html, \"class\") <- paste(xml_attr(html, \"class\"), class)\n+  } else {\n+    xml_attr(html, \"class\") <- class\n+  }\n+  viz[['output']] <- format(html)","path":"R/analytics.R","position":43,"original_position":43,"commit_id":"3d0d10e3b18bdad958920048a9499113fc427e84","original_commit_id":"3d0d10e3b18bdad958920048a9499113fc427e84","user":{"login":"jiwalker-usgs","id":1173041,"avatar_url":"https://avatars.githubusercontent.com/u/1173041?v=3","gravatar_id":"","url":"https://api.github.com/users/jiwalker-usgs","html_url":"https://github.com/jiwalker-usgs","followers_url":"https://api.github.com/users/jiwalker-usgs/followers","following_url":"https://api.github.com/users/jiwalker-usgs/following{/other_user}","gists_url":"https://api.github.com/users/jiwalker-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/jiwalker-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiwalker-usgs/subscriptions","organizations_url":"https://api.github.com/users/jiwalker-usgs/orgs","repos_url":"https://api.github.com/users/jiwalker-usgs/repos","events_url":"https://api.github.com/users/jiwalker-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/jiwalker-usgs/received_events","type":"User","site_admin":false},"body":"`format.xml` prints the content without extraneous information (prolog) which is what I need to eventually write the html out using whisker.","created_at":"2016-09-22T16:10:30Z","updated_at":"2016-09-22T16:10:30Z","html_url":"https://github.com/USGS-VIZLAB/vizlab/pull/58#discussion_r80077652","pull_request_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58","_links":{"self":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/comments/80077652"},"html":{"href":"https://github.com/USGS-VIZLAB/vizlab/pull/58#discussion_r80077652"},"pull_request":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58","id":85858926,"html_url":"https://github.com/USGS-VIZLAB/vizlab/pull/58","diff_url":"https://github.com/USGS-VIZLAB/vizlab/pull/58.diff","patch_url":"https://github.com/USGS-VIZLAB/vizlab/pull/58.patch","issue_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues/58","number":58,"state":"open","locked":false,"title":"Ga firstclass WIP","user":{"login":"jiwalker-usgs","id":1173041,"avatar_url":"https://avatars.githubusercontent.com/u/1173041?v=3","gravatar_id":"","url":"https://api.github.com/users/jiwalker-usgs","html_url":"https://github.com/jiwalker-usgs","followers_url":"https://api.github.com/users/jiwalker-usgs/followers","following_url":"https://api.github.com/users/jiwalker-usgs/following{/other_user}","gists_url":"https://api.github.com/users/jiwalker-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/jiwalker-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiwalker-usgs/subscriptions","organizations_url":"https://api.github.com/users/jiwalker-usgs/orgs","repos_url":"https://api.github.com/users/jiwalker-usgs/repos","events_url":"https://api.github.com/users/jiwalker-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/jiwalker-usgs/received_events","type":"User","site_admin":false},"body":"Need to implement the injection of analytics into templating","created_at":"2016-09-19T20:00:02Z","updated_at":"2016-09-22T16:10:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de8b3528cc845226ae81ea155b6944262569308d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58/commits","review_comments_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58/comments","review_comment_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues/58/comments","statuses_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/statuses/3d0d10e3b18bdad958920048a9499113fc427e84","head":{"label":"jiwalker-usgs:ga_firstclass","ref":"ga_firstclass","sha":"3d0d10e3b18bdad958920048a9499113fc427e84","user":{"login":"jiwalker-usgs","id":1173041,"avatar_url":"https://avatars.githubusercontent.com/u/1173041?v=3","gravatar_id":"","url":"https://api.github.com/users/jiwalker-usgs","html_url":"https://github.com/jiwalker-usgs","followers_url":"https://api.github.com/users/jiwalker-usgs/followers","following_url":"https://api.github.com/users/jiwalker-usgs/following{/other_user}","gists_url":"https://api.github.com/users/jiwalker-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/jiwalker-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiwalker-usgs/subscriptions","organizations_url":"https://api.github.com/users/jiwalker-usgs/orgs","repos_url":"https://api.github.com/users/jiwalker-usgs/repos","events_url":"https://api.github.com/users/jiwalker-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/jiwalker-usgs/received_events","type":"User","site_admin":false},"repo":{"id":60717095,"name":"vizlab","full_name":"jiwalker-usgs/vizlab","owner":{"login":"jiwalker-usgs","id":1173041,"avatar_url":"https://avatars.githubusercontent.com/u/1173041?v=3","gravatar_id":"","url":"https://api.github.com/users/jiwalker-usgs","html_url":"https://github.com/jiwalker-usgs","followers_url":"https://api.github.com/users/jiwalker-usgs/followers","following_url":"https://api.github.com/users/jiwalker-usgs/following{/other_user}","gists_url":"https://api.github.com/users/jiwalker-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/jiwalker-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiwalker-usgs/subscriptions","organizations_url":"https://api.github.com/users/jiwalker-usgs/orgs","repos_url":"https://api.github.com/users/jiwalker-usgs/repos","events_url":"https://api.github.com/users/jiwalker-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/jiwalker-usgs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jiwalker-usgs/vizlab","description":"Package with utilities for building vizlab pages","fork":true,"url":"https://api.github.com/repos/jiwalker-usgs/vizlab","forks_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/forks","keys_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/teams","hooks_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/hooks","issue_events_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/issues/events{/number}","events_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/events","assignees_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/assignees{/user}","branches_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/branches{/branch}","tags_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/tags","blobs_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/git/refs{/sha}","trees_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/statuses/{sha}","languages_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/languages","stargazers_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/stargazers","contributors_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/contributors","subscribers_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/subscribers","subscription_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/subscription","commits_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/commits{/sha}","git_commits_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/git/commits{/sha}","comments_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/comments{/number}","issue_comment_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/issues/comments{/number}","contents_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/contents/{+path}","compare_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/merges","archive_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/downloads","issues_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/issues{/number}","pulls_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/pulls{/number}","milestones_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/milestones{/number}","notifications_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/labels{/name}","releases_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/releases{/id}","deployments_url":"https://api.github.com/repos/jiwalker-usgs/vizlab/deployments","created_at":"2016-06-08T17:32:51Z","updated_at":"2016-06-13T16:40:20Z","pushed_at":"2016-09-22T15:47:26Z","git_url":"git://github.com/jiwalker-usgs/vizlab.git","ssh_url":"git@github.com:jiwalker-usgs/vizlab.git","clone_url":"https://github.com/jiwalker-usgs/vizlab.git","svn_url":"https://github.com/jiwalker-usgs/vizlab","homepage":null,"size":2021,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"USGS-VIZLAB:master","ref":"master","sha":"730192f5871d66def0dd1c7d20f664b06786bcb8","user":{"login":"USGS-VIZLAB","id":18291557,"avatar_url":"https://avatars.githubusercontent.com/u/18291557?v=3","gravatar_id":"","url":"https://api.github.com/users/USGS-VIZLAB","html_url":"https://github.com/USGS-VIZLAB","followers_url":"https://api.github.com/users/USGS-VIZLAB/followers","following_url":"https://api.github.com/users/USGS-VIZLAB/following{/other_user}","gists_url":"https://api.github.com/users/USGS-VIZLAB/gists{/gist_id}","starred_url":"https://api.github.com/users/USGS-VIZLAB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/USGS-VIZLAB/subscriptions","organizations_url":"https://api.github.com/users/USGS-VIZLAB/orgs","repos_url":"https://api.github.com/users/USGS-VIZLAB/repos","events_url":"https://api.github.com/users/USGS-VIZLAB/events{/privacy}","received_events_url":"https://api.github.com/users/USGS-VIZLAB/received_events","type":"Organization","site_admin":false},"repo":{"id":60549533,"name":"vizlab","full_name":"USGS-VIZLAB/vizlab","owner":{"login":"USGS-VIZLAB","id":18291557,"avatar_url":"https://avatars.githubusercontent.com/u/18291557?v=3","gravatar_id":"","url":"https://api.github.com/users/USGS-VIZLAB","html_url":"https://github.com/USGS-VIZLAB","followers_url":"https://api.github.com/users/USGS-VIZLAB/followers","following_url":"https://api.github.com/users/USGS-VIZLAB/following{/other_user}","gists_url":"https://api.github.com/users/USGS-VIZLAB/gists{/gist_id}","starred_url":"https://api.github.com/users/USGS-VIZLAB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/USGS-VIZLAB/subscriptions","organizations_url":"https://api.github.com/users/USGS-VIZLAB/orgs","repos_url":"https://api.github.com/users/USGS-VIZLAB/repos","events_url":"https://api.github.com/users/USGS-VIZLAB/events{/privacy}","received_events_url":"https://api.github.com/users/USGS-VIZLAB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/USGS-VIZLAB/vizlab","description":"Package with utilities for building vizlab pages","fork":false,"url":"https://api.github.com/repos/USGS-VIZLAB/vizlab","forks_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/forks","keys_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/teams","hooks_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/hooks","issue_events_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues/events{/number}","events_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/events","assignees_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/assignees{/user}","branches_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/branches{/branch}","tags_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/tags","blobs_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/git/refs{/sha}","trees_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/statuses/{sha}","languages_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/languages","stargazers_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/stargazers","contributors_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/contributors","subscribers_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/subscribers","subscription_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/subscription","commits_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/commits{/sha}","git_commits_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/git/commits{/sha}","comments_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/comments{/number}","issue_comment_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues/comments{/number}","contents_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/contents/{+path}","compare_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/merges","archive_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/downloads","issues_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues{/number}","pulls_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls{/number}","milestones_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/milestones{/number}","notifications_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/labels{/name}","releases_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/releases{/id}","deployments_url":"https://api.github.com/repos/USGS-VIZLAB/vizlab/deployments","created_at":"2016-06-06T18:04:11Z","updated_at":"2016-09-09T18:01:19Z","pushed_at":"2016-09-22T15:50:25Z","git_url":"git://github.com/USGS-VIZLAB/vizlab.git","ssh_url":"git@github.com:USGS-VIZLAB/vizlab.git","clone_url":"https://github.com/USGS-VIZLAB/vizlab.git","svn_url":"https://github.com/USGS-VIZLAB/vizlab","homepage":null,"size":2059,"stargazers_count":3,"watchers_count":3,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":27,"forks":8,"open_issues":27,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58"},"html":{"href":"https://github.com/USGS-VIZLAB/vizlab/pull/58"},"issue":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues/58"},"comments":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/USGS-VIZLAB/vizlab/statuses/3d0d10e3b18bdad958920048a9499113fc427e84"}}}}
{"actor":{"display_login":"jiwalker-usgs"}}