{"action":"created","comment":{"url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/comments/85427779","pull_request_review_id":6146107,"id":85427779,"diff_hunk":"@@ -68,6 +70,19 @@ export class Client implements AnalyticsClient {\n \n     sendViewEvent(request: ViewEventRequest): Promise<ViewEventResponse> {\n         if (request.referrer === '') { delete request.referrer; }\n+\n+        // Check if we are in a browser env\n+        if (hasDocumentLocation()) {","path":"src/analytics.ts","position":15,"original_position":15,"commit_id":"c588f82752920459f4c1543435db8e773a2b04ed","original_commit_id":"c588f82752920459f4c1543435db8e773a2b04ed","user":{"login":"olamothe","id":1591893,"avatar_url":"https://avatars.githubusercontent.com/u/1591893?v=3","gravatar_id":"","url":"https://api.github.com/users/olamothe","html_url":"https://github.com/olamothe","followers_url":"https://api.github.com/users/olamothe/followers","following_url":"https://api.github.com/users/olamothe/following{/other_user}","gists_url":"https://api.github.com/users/olamothe/gists{/gist_id}","starred_url":"https://api.github.com/users/olamothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olamothe/subscriptions","organizations_url":"https://api.github.com/users/olamothe/orgs","repos_url":"https://api.github.com/users/olamothe/repos","events_url":"https://api.github.com/users/olamothe/events{/privacy}","received_events_url":"https://api.github.com/users/olamothe/received_events","type":"User","site_admin":false},"body":"You mean someone doing an implementation error and logging the same view event multiple time ?\r\n\r\nHow do you propose we fix that ? \r\n\r\nI guess we could remove duplicate view event (same url) inside the HistoryStore, so that we do not keep 2 duplicate values in a row. \r\nThis would be slightly wrong if someone reload a single page multiple time, but acceptable I think (since for reveal, it should really be just a single page view after all).\r\n\r\nOr if someone leave a \"session\" on a given page view, then comes back a day later on the same page view (from google let's say), then we would wrongly remove the view event.","created_at":"2016-10-27T21:06:47Z","updated_at":"2016-10-27T21:06:47Z","html_url":"https://github.com/coveo/coveo.analytics.js/pull/108#discussion_r85427779","pull_request_url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/comments/85427779"},"html":{"href":"https://github.com/coveo/coveo.analytics.js/pull/108#discussion_r85427779"},"pull_request":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108","id":91271010,"html_url":"https://github.com/coveo/coveo.analytics.js/pull/108","diff_url":"https://github.com/coveo/coveo.analytics.js/pull/108.diff","patch_url":"https://github.com/coveo/coveo.analytics.js/pull/108.patch","issue_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/108","number":108,"state":"open","locked":false,"title":"Improve store for page view events","user":{"login":"olamothe","id":1591893,"avatar_url":"https://avatars.githubusercontent.com/u/1591893?v=3","gravatar_id":"","url":"https://api.github.com/users/olamothe","html_url":"https://github.com/olamothe","followers_url":"https://api.github.com/users/olamothe/followers","following_url":"https://api.github.com/users/olamothe/following{/other_user}","gists_url":"https://api.github.com/users/olamothe/gists{/gist_id}","starred_url":"https://api.github.com/users/olamothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olamothe/subscriptions","organizations_url":"https://api.github.com/users/olamothe/orgs","repos_url":"https://api.github.com/users/olamothe/repos","events_url":"https://api.github.com/users/olamothe/events{/privacy}","received_events_url":"https://api.github.com/users/olamothe/received_events","type":"User","site_admin":false},"body":"Before this PR, the \"page view\" event was added to the history store only when the script is first loaded in the page.\r\n\r\nThis works fine for full page reload, but in the context of a single page app (eg: an angular website), the store is not properly updated when a new page is effectively loaded.\r\n\r\nThis PR moves this logic to the analytics class, since angular user will need to call the \"sendViewEvent\" somewhere in their app (eg: inside their angular router).\r\n\r\nThis ensure that the store is properly updated whenever a page view event is sent.\r\n\r\n\r\nI also added a single definition file for the library, so it's easier to use for external typescript project(s). This could also be submitted to the DefinitelyTyped repo in the future for easier integrations.\r\n\r\nThe definition file is also compiled on each build, to ensure that it is at least valid typescript.","created_at":"2016-10-27T20:06:23Z","updated_at":"2016-10-27T21:06:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f1b7f7b1e355a5726cbebbf8e05e27767c1ff9b","assignee":{"login":"pastjean","id":140675,"avatar_url":"https://avatars.githubusercontent.com/u/140675?v=3","gravatar_id":"","url":"https://api.github.com/users/pastjean","html_url":"https://github.com/pastjean","followers_url":"https://api.github.com/users/pastjean/followers","following_url":"https://api.github.com/users/pastjean/following{/other_user}","gists_url":"https://api.github.com/users/pastjean/gists{/gist_id}","starred_url":"https://api.github.com/users/pastjean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pastjean/subscriptions","organizations_url":"https://api.github.com/users/pastjean/orgs","repos_url":"https://api.github.com/users/pastjean/repos","events_url":"https://api.github.com/users/pastjean/events{/privacy}","received_events_url":"https://api.github.com/users/pastjean/received_events","type":"User","site_admin":false},"assignees":[{"login":"pastjean","id":140675,"avatar_url":"https://avatars.githubusercontent.com/u/140675?v=3","gravatar_id":"","url":"https://api.github.com/users/pastjean","html_url":"https://github.com/pastjean","followers_url":"https://api.github.com/users/pastjean/followers","following_url":"https://api.github.com/users/pastjean/following{/other_user}","gists_url":"https://api.github.com/users/pastjean/gists{/gist_id}","starred_url":"https://api.github.com/users/pastjean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pastjean/subscriptions","organizations_url":"https://api.github.com/users/pastjean/orgs","repos_url":"https://api.github.com/users/pastjean/repos","events_url":"https://api.github.com/users/pastjean/events{/privacy}","received_events_url":"https://api.github.com/users/pastjean/received_events","type":"User","site_admin":false},{"login":"francoislg","id":8355585,"avatar_url":"https://avatars.githubusercontent.com/u/8355585?v=3","gravatar_id":"","url":"https://api.github.com/users/francoislg","html_url":"https://github.com/francoislg","followers_url":"https://api.github.com/users/francoislg/followers","following_url":"https://api.github.com/users/francoislg/following{/other_user}","gists_url":"https://api.github.com/users/francoislg/gists{/gist_id}","starred_url":"https://api.github.com/users/francoislg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francoislg/subscriptions","organizations_url":"https://api.github.com/users/francoislg/orgs","repos_url":"https://api.github.com/users/francoislg/repos","events_url":"https://api.github.com/users/francoislg/events{/privacy}","received_events_url":"https://api.github.com/users/francoislg/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108/commits","review_comments_url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108/comments","review_comment_url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/108/comments","statuses_url":"https://api.github.com/repos/coveo/coveo.analytics.js/statuses/c588f82752920459f4c1543435db8e773a2b04ed","head":{"label":"coveo:improve-store-add-view","ref":"improve-store-add-view","sha":"c588f82752920459f4c1543435db8e773a2b04ed","user":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":56099312,"name":"coveo.analytics.js","full_name":"coveo/coveo.analytics.js","owner":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/coveo.analytics.js","description":"coveo.analytics.js","fork":false,"url":"https://api.github.com/repos/coveo/coveo.analytics.js","forks_url":"https://api.github.com/repos/coveo/coveo.analytics.js/forks","keys_url":"https://api.github.com/repos/coveo/coveo.analytics.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/coveo.analytics.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/coveo.analytics.js/teams","hooks_url":"https://api.github.com/repos/coveo/coveo.analytics.js/hooks","issue_events_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/coveo.analytics.js/events","assignees_url":"https://api.github.com/repos/coveo/coveo.analytics.js/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/coveo.analytics.js/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/coveo.analytics.js/tags","blobs_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/coveo.analytics.js/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/coveo.analytics.js/languages","stargazers_url":"https://api.github.com/repos/coveo/coveo.analytics.js/stargazers","contributors_url":"https://api.github.com/repos/coveo/coveo.analytics.js/contributors","subscribers_url":"https://api.github.com/repos/coveo/coveo.analytics.js/subscribers","subscription_url":"https://api.github.com/repos/coveo/coveo.analytics.js/subscription","commits_url":"https://api.github.com/repos/coveo/coveo.analytics.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/coveo.analytics.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/coveo.analytics.js/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/coveo.analytics.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/coveo.analytics.js/merges","archive_url":"https://api.github.com/repos/coveo/coveo.analytics.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/coveo.analytics.js/downloads","issues_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/coveo.analytics.js/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/coveo.analytics.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/coveo.analytics.js/labels{/name}","releases_url":"https://api.github.com/repos/coveo/coveo.analytics.js/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/coveo.analytics.js/deployments","created_at":"2016-04-12T21:33:11Z","updated_at":"2016-10-25T05:19:09Z","pushed_at":"2016-10-27T20:06:23Z","git_url":"git://github.com/coveo/coveo.analytics.js.git","ssh_url":"git@github.com:coveo/coveo.analytics.js.git","clone_url":"https://github.com/coveo/coveo.analytics.js.git","svn_url":"https://github.com/coveo/coveo.analytics.js","homepage":"","size":558,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"coveo:master","ref":"master","sha":"196399282fa579cee803e1c1b9ed815c8442a6a4","user":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":56099312,"name":"coveo.analytics.js","full_name":"coveo/coveo.analytics.js","owner":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/coveo.analytics.js","description":"coveo.analytics.js","fork":false,"url":"https://api.github.com/repos/coveo/coveo.analytics.js","forks_url":"https://api.github.com/repos/coveo/coveo.analytics.js/forks","keys_url":"https://api.github.com/repos/coveo/coveo.analytics.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/coveo.analytics.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/coveo.analytics.js/teams","hooks_url":"https://api.github.com/repos/coveo/coveo.analytics.js/hooks","issue_events_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/coveo.analytics.js/events","assignees_url":"https://api.github.com/repos/coveo/coveo.analytics.js/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/coveo.analytics.js/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/coveo.analytics.js/tags","blobs_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/coveo.analytics.js/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/coveo.analytics.js/languages","stargazers_url":"https://api.github.com/repos/coveo/coveo.analytics.js/stargazers","contributors_url":"https://api.github.com/repos/coveo/coveo.analytics.js/contributors","subscribers_url":"https://api.github.com/repos/coveo/coveo.analytics.js/subscribers","subscription_url":"https://api.github.com/repos/coveo/coveo.analytics.js/subscription","commits_url":"https://api.github.com/repos/coveo/coveo.analytics.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/coveo.analytics.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/coveo.analytics.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/coveo.analytics.js/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/coveo.analytics.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/coveo.analytics.js/merges","archive_url":"https://api.github.com/repos/coveo/coveo.analytics.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/coveo.analytics.js/downloads","issues_url":"https://api.github.com/repos/coveo/coveo.analytics.js/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/coveo.analytics.js/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/coveo.analytics.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/coveo.analytics.js/labels{/name}","releases_url":"https://api.github.com/repos/coveo/coveo.analytics.js/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/coveo.analytics.js/deployments","created_at":"2016-04-12T21:33:11Z","updated_at":"2016-10-25T05:19:09Z","pushed_at":"2016-10-27T20:06:23Z","git_url":"git://github.com/coveo/coveo.analytics.js.git","ssh_url":"git@github.com:coveo/coveo.analytics.js.git","clone_url":"https://github.com/coveo/coveo.analytics.js.git","svn_url":"https://github.com/coveo/coveo.analytics.js","homepage":"","size":558,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108"},"html":{"href":"https://github.com/coveo/coveo.analytics.js/pull/108"},"issue":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/108"},"comments":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/coveo/coveo.analytics.js/statuses/c588f82752920459f4c1543435db8e773a2b04ed"}}}}
{"actor":{"display_login":"olamothe"}}