{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/frontend/pulls/comments/166898038","pull_request_review_id":95029733,"id":166898038,"diff_hunk":"@@ -0,0 +1,34 @@\n+// @flow\n+import type { ImpressionViewableEvent } from 'commercial/types';\n+\n+import { Advert } from 'commercial/modules/dfp/Advert';\n+import { getAdvertById } from 'commercial/modules/dfp/get-advert-by-id';\n+import { refreshAdvert } from 'commercial/modules/dfp/load-advert';\n+\n+const viweabilityThresholdMs = 30000;\n+\n+export const onSlotViewable = (event: ImpressionViewableEvent): void => {\n+    const advert: ?Advert = getAdvertById(event.slot.getSlotElementId());\n+    if (advert) {\n+        const onDocumentVisible = () => {\n+            if (!document.hidden) {\n+                document.removeEventListener(\n+                    'visibilitychange',\n+                    onDocumentVisible","path":"static/src/javascripts/projects/commercial/modules/dfp/on-slot-viewable.js","position":17,"original_position":17,"commit_id":"dc76ce18fed62450b3bfd9d6f8c78d6c5c5af5cf","original_commit_id":"dc76ce18fed62450b3bfd9d6f8c78d6c5c5af5cf","user":{"login":"LATaylor-guardian","id":8861681,"avatar_url":"https://avatars1.githubusercontent.com/u/8861681?v=4","gravatar_id":"","url":"https://api.github.com/users/LATaylor-guardian","html_url":"https://github.com/LATaylor-guardian","followers_url":"https://api.github.com/users/LATaylor-guardian/followers","following_url":"https://api.github.com/users/LATaylor-guardian/following{/other_user}","gists_url":"https://api.github.com/users/LATaylor-guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/LATaylor-guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LATaylor-guardian/subscriptions","organizations_url":"https://api.github.com/users/LATaylor-guardian/orgs","repos_url":"https://api.github.com/users/LATaylor-guardian/repos","events_url":"https://api.github.com/users/LATaylor-guardian/events{/privacy}","received_events_url":"https://api.github.com/users/LATaylor-guardian/received_events","type":"User","site_admin":false},"body":"Is this correct? It's referring to itself.","created_at":"2018-02-08T10:53:48Z","updated_at":"2018-02-08T10:53:48Z","html_url":"https://github.com/guardian/frontend/pull/19087#discussion_r166898038","pull_request_url":"https://api.github.com/repos/guardian/frontend/pulls/19087","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments/166898038"},"html":{"href":"https://github.com/guardian/frontend/pull/19087#discussion_r166898038"},"pull_request":{"href":"https://api.github.com/repos/guardian/frontend/pulls/19087"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/frontend/pulls/19087","id":167486534,"html_url":"https://github.com/guardian/frontend/pull/19087","diff_url":"https://github.com/guardian/frontend/pull/19087.diff","patch_url":"https://github.com/guardian/frontend/pull/19087.patch","issue_url":"https://api.github.com/repos/guardian/frontend/issues/19087","number":19087,"state":"open","locked":false,"title":"Create 5% test for refreshing ads that have been viewable for 30+ seconds","user":{"login":"JonNorman","id":1821099,"avatar_url":"https://avatars2.githubusercontent.com/u/1821099?v=4","gravatar_id":"","url":"https://api.github.com/users/JonNorman","html_url":"https://github.com/JonNorman","followers_url":"https://api.github.com/users/JonNorman/followers","following_url":"https://api.github.com/users/JonNorman/following{/other_user}","gists_url":"https://api.github.com/users/JonNorman/gists{/gist_id}","starred_url":"https://api.github.com/users/JonNorman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonNorman/subscriptions","organizations_url":"https://api.github.com/users/JonNorman/orgs","repos_url":"https://api.github.com/users/JonNorman/repos","events_url":"https://api.github.com/users/JonNorman/events{/privacy}","received_events_url":"https://api.github.com/users/JonNorman/received_events","type":"User","site_admin":false},"body":"## What does this change?\r\n1. Updates the preexisting `refresh-on-resize` to refresh ad slots via our prebid entry point, rather than the DFP entry point. This means that we get up-to-date prebid header bidding information on the refreshed ad.\r\n\r\n2. Creates a 5% server-side test wherein the variant cohort will request a refresh of the ad 30 seconds after the ad has become viewable. We use an [event](https://developers.google.com/doubleclick-gpt/reference#googletageventsimpressionviewableevent) tied to DFP's [Active View](https://support.google.com/dfp_premium/answer/4524488?hl=en&visit_id=1-636535364226239161-2940600065&rd=1) criteria:\r\n\r\n> - For ads, 50% of the ad’s pixels are visible in the browser window for a continuous 1 second.\r\n> - For larger ads (those greater than 242,000 pixels), 30% of the ad’s pixels are visible in the browser window.\r\n> - For in-stream video ads, 50% of the ad’s pixels must be visible in the browser window for a continuous 2 seconds.\r\n\r\n3. In either case (refreshing due to viewport changes or viewability thresholds) the additional targeting information `refreshed=true` will be passed up into the ad call.\r\n\r\n**Considerations (for discussion here)**\r\n1. Do we want to restrict the ad slots that can be refreshed? Should we refresh high-merchandising?\r\n2. Do we want to check that the tab is active before refreshing an ad? Is there anything else that may want to stay our ad-refreshing fingers?\r\n\r\n## What is the value of this and can you measure success?\r\nPhat thtackth.","created_at":"2018-02-06T17:57:20Z","updated_at":"2018-02-08T10:53:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"711e3b0aa7afa4602d9cc8dc3088d5537739c69f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/frontend/pulls/19087/commits","review_comments_url":"https://api.github.com/repos/guardian/frontend/pulls/19087/comments","review_comment_url":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/frontend/issues/19087/comments","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/dc76ce18fed62450b3bfd9d6f8c78d6c5c5af5cf","head":{"label":"guardian:jn-refresh-ads","ref":"jn-refresh-ads","sha":"dc76ce18fed62450b3bfd9d6f8c78d6c5c5af5cf","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2018-02-06T11:43:22Z","pushed_at":"2018-02-08T10:51:05Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"https://www.theguardian.com","size":579097,"stargazers_count":3781,"watchers_count":3781,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":400,"mirror_url":null,"archived":false,"open_issues_count":57,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":400,"open_issues":57,"watchers":3781,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"dc4bbf9884d39453f97c415abaf90e90eed94058","user":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":4370755,"name":"frontend","full_name":"guardian/frontend","owner":{"login":"guardian","id":164318,"avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/frontend","description":"Source for theguardian.com","fork":false,"url":"https://api.github.com/repos/guardian/frontend","forks_url":"https://api.github.com/repos/guardian/frontend/forks","keys_url":"https://api.github.com/repos/guardian/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/frontend/teams","hooks_url":"https://api.github.com/repos/guardian/frontend/hooks","issue_events_url":"https://api.github.com/repos/guardian/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/frontend/events","assignees_url":"https://api.github.com/repos/guardian/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/frontend/tags","blobs_url":"https://api.github.com/repos/guardian/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/frontend/languages","stargazers_url":"https://api.github.com/repos/guardian/frontend/stargazers","contributors_url":"https://api.github.com/repos/guardian/frontend/contributors","subscribers_url":"https://api.github.com/repos/guardian/frontend/subscribers","subscription_url":"https://api.github.com/repos/guardian/frontend/subscription","commits_url":"https://api.github.com/repos/guardian/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/frontend/merges","archive_url":"https://api.github.com/repos/guardian/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/frontend/downloads","issues_url":"https://api.github.com/repos/guardian/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/frontend/labels{/name}","releases_url":"https://api.github.com/repos/guardian/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/frontend/deployments","created_at":"2012-05-18T15:39:15Z","updated_at":"2018-02-06T11:43:22Z","pushed_at":"2018-02-08T10:51:05Z","git_url":"git://github.com/guardian/frontend.git","ssh_url":"git@github.com:guardian/frontend.git","clone_url":"https://github.com/guardian/frontend.git","svn_url":"https://github.com/guardian/frontend","homepage":"https://www.theguardian.com","size":579097,"stargazers_count":3781,"watchers_count":3781,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":400,"mirror_url":null,"archived":false,"open_issues_count":57,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":400,"open_issues":57,"watchers":3781,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/frontend/pulls/19087"},"html":{"href":"https://github.com/guardian/frontend/pull/19087"},"issue":{"href":"https://api.github.com/repos/guardian/frontend/issues/19087"},"comments":{"href":"https://api.github.com/repos/guardian/frontend/issues/19087/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/frontend/pulls/19087/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/frontend/pulls/19087/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/frontend/statuses/dc76ce18fed62450b3bfd9d6f8c78d6c5c5af5cf"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"LATaylor-guardian"}}