{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments/186415850","pull_request_review_id":117987804,"id":186415850,"diff_hunk":"@@ -0,0 +1,169 @@\n+/* @flow */\n+import makeClassName from 'classnames';\n+import { oneLine } from 'common-tags';\n+import invariant from 'invariant';\n+import * as React from 'react';\n+import defaultCookie from 'react-cookie';\n+import { compose } from 'redux';\n+import { connect } from 'react-redux';\n+\n+import AddonsCard from 'amo/components/AddonsCard';\n+import {\n+  fetchRecommendations,\n+  getRecommendationsByGuid,\n+} from 'amo/reducers/recommendations';\n+import { withErrorHandler } from 'core/errorHandler';\n+import translate from 'core/i18n/translate';\n+import defaultTracking from 'core/tracking';\n+import type {\n+  Recommendations,\n+  RecommendationsState,\n+} from 'amo/reducers/recommendations';\n+import type { ErrorHandlerType } from 'core/errorHandler';\n+import type { I18nType } from 'core/types/i18n';\n+import type { AddonType } from 'core/types/addons';\n+import type { DispatchFunc } from 'core/types/redux';\n+\n+export const TAAR_IMPRESSION_CATEGORY = 'AMO Addon / Recommendations Shown';\n+export const TAAR_COHORT_COOKIE_NAME = 'TAARCohort';\n+export const TAAR_COHORT_INCLUDED: 'TAAR_COHORT_INCLUDED'\n+  = 'TAAR_COHORT_INCLUDED';\n+export const TAAR_COHORT_EXCLUDED: 'TAAR_COHORT_EXCLUDED'\n+  = 'TAAR_COHORT_EXCLUDED';\n+\n+export type CohortName = typeof TAAR_COHORT_INCLUDED | typeof TAAR_COHORT_EXCLUDED;\n+\n+type Props = {|\n+  cookie: typeof defaultCookie,\n+  randomizer: () => number,\n+  tracking: typeof defaultTracking,\n+  addon: AddonType | null,\n+  className?: string,\n+  dispatch: DispatchFunc,\n+  errorHandler: ErrorHandlerType,\n+  i18n: I18nType,\n+  recommendations: Recommendations | null,\n+|};\n+\n+\n+export class AddonRecommendationsBase extends React.Component<Props> {\n+  static defaultProps = {\n+    cookie: defaultCookie,\n+    randomizer: Math.random,\n+    tracking: defaultTracking,\n+    recommendations: null,\n+  };\n+\n+  componentWillMount() {\n+    const { cookie, randomizer, addon, recommendations } = this.props;\n+\n+    // Set a cohort for the experiment.\n+    this.cohort = cookie.load(TAAR_COHORT_COOKIE_NAME);\n+    if (this.cohort === undefined) {\n+      this.cohort = randomizer() > 0.5 ?\n+        TAAR_COHORT_INCLUDED : TAAR_COHORT_EXCLUDED;\n+      cookie.save(TAAR_COHORT_COOKIE_NAME, this.cohort, { path: '/' });\n+    }\n+\n+    if (!!addon && !recommendations) {","path":"src/amo/components/AddonRecommendations/index.js","position":68,"original_position":68,"commit_id":"8117adc52e3e71c0c7da72c1909b596f90681ef3","original_commit_id":"8117adc52e3e71c0c7da72c1909b596f90681ef3","user":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars1.githubusercontent.com/u/142755?v=4","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"body":"I thought I ran into a problem with that, when `addon` was `null`, but now I don't see why that would have been. Perhaps it was with a different iteration of the code. Yes, I'll switch it to `addon`.","created_at":"2018-05-07T13:02:52Z","updated_at":"2018-05-07T13:02:52Z","html_url":"https://github.com/mozilla/addons-frontend/pull/4942#discussion_r186415850","pull_request_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments/186415850"},"html":{"href":"https://github.com/mozilla/addons-frontend/pull/4942#discussion_r186415850"},"pull_request":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942"}},"in_reply_to_id":186365406},"pull_request":{"url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942","id":186244175,"html_url":"https://github.com/mozilla/addons-frontend/pull/4942","diff_url":"https://github.com/mozilla/addons-frontend/pull/4942.diff","patch_url":"https://github.com/mozilla/addons-frontend/pull/4942.patch","issue_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/4942","number":4942,"state":"open","locked":false,"title":"Use taar for recommendations","user":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars1.githubusercontent.com/u/142755?v=4","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"body":"Fixes #4866 \r\n\r\nNote that this builds upon the work in PR #4904, so the first two commits can be ignored for the purpose of this review.\r\n\r\nNote as well that I have addressed all of the issues raised against PR #4869 and included those changes in this code.\r\n\r\nAlso note that all of the analytics reporting hasn't been fully figured out yet, but I think the general design of this component is ready for a review. I think the tests could use a bit of polish, but I wanted to submit the code for review now, with the hope of possibly landing it in this week's tag.\r\n","created_at":"2018-05-07T02:47:50Z","updated_at":"2018-05-07T13:02:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc905d94db445855b0085bfaf87dc5f550559362","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942/commits","review_comments_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942/comments","review_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/4942/comments","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/8117adc52e3e71c0c7da72c1909b596f90681ef3","head":{"label":"bobsilverberg:use-taar-for-recommendations","ref":"use-taar-for-recommendations","sha":"8117adc52e3e71c0c7da72c1909b596f90681ef3","user":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars1.githubusercontent.com/u/142755?v=4","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"repo":{"id":118461865,"name":"addons-frontend","full_name":"bobsilverberg/addons-frontend","owner":{"login":"bobsilverberg","id":142755,"avatar_url":"https://avatars1.githubusercontent.com/u/142755?v=4","gravatar_id":"","url":"https://api.github.com/users/bobsilverberg","html_url":"https://github.com/bobsilverberg","followers_url":"https://api.github.com/users/bobsilverberg/followers","following_url":"https://api.github.com/users/bobsilverberg/following{/other_user}","gists_url":"https://api.github.com/users/bobsilverberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bobsilverberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobsilverberg/subscriptions","organizations_url":"https://api.github.com/users/bobsilverberg/orgs","repos_url":"https://api.github.com/users/bobsilverberg/repos","events_url":"https://api.github.com/users/bobsilverberg/events{/privacy}","received_events_url":"https://api.github.com/users/bobsilverberg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bobsilverberg/addons-frontend","description":"Front-end to complement mozilla/addons-server","fork":true,"url":"https://api.github.com/repos/bobsilverberg/addons-frontend","forks_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/forks","keys_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/teams","hooks_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/hooks","issue_events_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/events","assignees_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/tags","blobs_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/languages","stargazers_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/stargazers","contributors_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/contributors","subscribers_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/subscribers","subscription_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/subscription","commits_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/merges","archive_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/downloads","issues_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/labels{/name}","releases_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/bobsilverberg/addons-frontend/deployments","created_at":"2018-01-22T13:37:47Z","updated_at":"2018-05-07T12:38:14Z","pushed_at":"2018-05-07T12:38:13Z","git_url":"git://github.com/bobsilverberg/addons-frontend.git","ssh_url":"git@github.com:bobsilverberg/addons-frontend.git","clone_url":"https://github.com/bobsilverberg/addons-frontend.git","svn_url":"https://github.com/bobsilverberg/addons-frontend","homepage":"","size":509078,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"2111ff06c6a9499d39a7d1db29d828285b6986ee","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":52104368,"name":"addons-frontend","full_name":"mozilla/addons-frontend","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/addons-frontend","description":"Front-end to complement mozilla/addons-server","fork":false,"url":"https://api.github.com/repos/mozilla/addons-frontend","forks_url":"https://api.github.com/repos/mozilla/addons-frontend/forks","keys_url":"https://api.github.com/repos/mozilla/addons-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/addons-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/addons-frontend/teams","hooks_url":"https://api.github.com/repos/mozilla/addons-frontend/hooks","issue_events_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/addons-frontend/events","assignees_url":"https://api.github.com/repos/mozilla/addons-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/addons-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/addons-frontend/tags","blobs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/addons-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/addons-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/addons-frontend/languages","stargazers_url":"https://api.github.com/repos/mozilla/addons-frontend/stargazers","contributors_url":"https://api.github.com/repos/mozilla/addons-frontend/contributors","subscribers_url":"https://api.github.com/repos/mozilla/addons-frontend/subscribers","subscription_url":"https://api.github.com/repos/mozilla/addons-frontend/subscription","commits_url":"https://api.github.com/repos/mozilla/addons-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/addons-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/addons-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/addons-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/addons-frontend/merges","archive_url":"https://api.github.com/repos/mozilla/addons-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/addons-frontend/downloads","issues_url":"https://api.github.com/repos/mozilla/addons-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/addons-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/addons-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/addons-frontend/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/addons-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/addons-frontend/deployments","created_at":"2016-02-19T17:25:57Z","updated_at":"2018-05-07T12:47:00Z","pushed_at":"2018-05-07T13:00:24Z","git_url":"git://github.com/mozilla/addons-frontend.git","ssh_url":"git@github.com:mozilla/addons-frontend.git","clone_url":"https://github.com/mozilla/addons-frontend.git","svn_url":"https://github.com/mozilla/addons-frontend","homepage":"","size":509590,"stargazers_count":193,"watchers_count":193,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":135,"mirror_url":null,"archived":false,"open_issues_count":469,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0"},"forks":135,"open_issues":469,"watchers":193,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942"},"html":{"href":"https://github.com/mozilla/addons-frontend/pull/4942"},"issue":{"href":"https://api.github.com/repos/mozilla/addons-frontend/issues/4942"},"comments":{"href":"https://api.github.com/repos/mozilla/addons-frontend/issues/4942/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/4942/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/addons-frontend/statuses/8117adc52e3e71c0c7da72c1909b596f90681ef3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bobsilverberg"}}