{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments/30603395","id":30603395,"diff_hunk":"@@ -10,6 +10,72 @@ var uaParser = require('ua-parser');\n \n var STATSD_PREFIX = 'fxa.content.';\n \n+function getGenericTags(body) {\n+  /*jshint maxcomplexity:7 */\n+  // see more about tags here: http://docs.datadoghq.com/guides/metrics/\n+  var tags = [\n+    'campaign:' + body.campaign,\n+    'context:' + body.context,\n+    'broker:' + body.broker,\n+    'entrypoint:' + body.entrypoint,\n+    'migration:' + body.migration,\n+    'lang:' + body.lang,\n+    'service:' + body.service\n+  ];\n+\n+  if (body.screen) {\n+    var screen = body.screen;\n+\n+    tags = tags.concat([\n+      'screen_client_width:' + screen.clientWidth,\n+      'screen_client_height:' + screen.clientHeight,\n+      'screen_device_pixel_ratio:' + screen.devicePixelRatio,\n+      'screen_width:' + screen.width,\n+      'screen_height:' + screen.height\n+    ]);\n+  }\n+\n+  if (body.agent) {\n+    var agent = uaParser.parse(body.agent);\n+    if (agent) {\n+      if (agent.ua) {\n+        tags = tags.concat([\n+          'agent_ua_name:' + agent.ua.toString(), // -> \"Safari 5.0.1\"\n+          'agent_ua_family:' + agent.ua.family, // -> \"Safari\"\n+          'agent_ua_version:' + agent.ua.toVersionString(), // -> \"5.0.1\"\n+          'agent_ua_version_major:' + agent.ua.major // -> \"5\"\n+        ]);\n+      }\n+\n+      if (agent.os) {\n+        tags = tags.concat([\n+          'agent_os_name:' + agent.os.toString(), // -> \"iOS 5.1\"\n+          'agent_os_version:' + agent.os.toVersionString(), // -> \"5.1\"\n+          'agent_os_family:' + agent.os.family, // -> \"iOS\"\n+          'agent_os_major:' + agent.os.major // -> \"5\"\n+        ]);\n+      }\n+\n+      if (agent.device) {\n+        tags = tags.concat([\n+          'agent_device:' + agent.device.family // -> \"iPhone\"\n+        ]);\n+      }\n+    }\n+  }\n+\n+  return tags;\n+}\n+\n+\n+function getImpressionTags(impression) {\n+  return [\n+    'marketing_campaignId:' + impression.campaignId,","path":"server/lib/statsd-collector.js","position":64,"original_position":64,"commit_id":"3938f6e0355eb11cf6f9f6d0c6d11e58849cfb6e","original_commit_id":"3938f6e0355eb11cf6f9f6d0c6d11e58849cfb6e","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"body":"Ah, I did not read their blurb closely enough. Thanks for pointing that out.\r\n\r\nAn yep, `marketing_campaign_id` is better than `marketing_campaignid`. Updating.","created_at":"2015-05-19T14:19:19Z","updated_at":"2015-05-19T14:19:19Z","html_url":"https://github.com/mozilla/fxa-content-server/pull/2389#discussion_r30603395","pull_request_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments/30603395"},"html":{"href":"https://github.com/mozilla/fxa-content-server/pull/2389#discussion_r30603395"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389","id":34918468,"html_url":"https://github.com/mozilla/fxa-content-server/pull/2389","diff_url":"https://github.com/mozilla/fxa-content-server/pull/2389.diff","patch_url":"https://github.com/mozilla/fxa-content-server/pull/2389.patch","issue_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2389","number":2389,"state":"open","locked":false,"title":"feature(client): Report multiple marketing links.","user":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"body":"* Extract the marketing link handling code into its own mixin module.\r\n* The call to POST /metrics contains a `marketing` field.\r\n  * `marketing` contains `campaignId`, `url`, and `clicked`.\r\n* Marketing impressions are reported to Heka separately from the rest of the metrics.\r\n\r\nAn example marketing entry:\r\n```json\r\n{\r\n  \"campaignId\":\"spring-2015-android-ios-sync\",\r\n  \"url\":\"https://www.mozilla.org/newsletter/ios/\",\r\n  \"clicked\":false,\r\n  \"time\":\"2015-05-11T13:00:00.000Z\",\r\n  \"op\":\"client.marketing\",\r\n  \"hostname\":\"Shanes-Retina-MBP.local\",\r\n  \"pid\":64280,\r\n  \"v\":1,\r\n  \"lang\":\"en\",\r\n  \"agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0\", \r\n  \"context\":\"web\",\r\n  \"entrypoint\":\"none\",\r\n  \"service\":\"sync\",\r\n  \"migration\":\"none\"\r\n}\r\n```\r\nfixes #2338","created_at":"2015-05-07T14:03:35Z","updated_at":"2015-05-19T14:19:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fc506cc4492bc71c0c35af179dcd5854aa39f586","assignee":{"login":"vladikoff","id":128755,"avatar_url":"https://avatars.githubusercontent.com/u/128755?v=3","gravatar_id":"","url":"https://api.github.com/users/vladikoff","html_url":"https://github.com/vladikoff","followers_url":"https://api.github.com/users/vladikoff/followers","following_url":"https://api.github.com/users/vladikoff/following{/other_user}","gists_url":"https://api.github.com/users/vladikoff/gists{/gist_id}","starred_url":"https://api.github.com/users/vladikoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladikoff/subscriptions","organizations_url":"https://api.github.com/users/vladikoff/orgs","repos_url":"https://api.github.com/users/vladikoff/repos","events_url":"https://api.github.com/users/vladikoff/events{/privacy}","received_events_url":"https://api.github.com/users/vladikoff/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones/48","html_url":"https://github.com/mozilla/fxa-content-server/milestones/train%2038","labels_url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones/48/labels","id":1044666,"number":48,"title":"train 38","description":"Train 37 - May 12-May 25","creator":{"login":"shane-tomlinson","id":848085,"avatar_url":"https://avatars.githubusercontent.com/u/848085?v=3","gravatar_id":"","url":"https://api.github.com/users/shane-tomlinson","html_url":"https://github.com/shane-tomlinson","followers_url":"https://api.github.com/users/shane-tomlinson/followers","following_url":"https://api.github.com/users/shane-tomlinson/following{/other_user}","gists_url":"https://api.github.com/users/shane-tomlinson/gists{/gist_id}","starred_url":"https://api.github.com/users/shane-tomlinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shane-tomlinson/subscriptions","organizations_url":"https://api.github.com/users/shane-tomlinson/orgs","repos_url":"https://api.github.com/users/shane-tomlinson/repos","events_url":"https://api.github.com/users/shane-tomlinson/events{/privacy}","received_events_url":"https://api.github.com/users/shane-tomlinson/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":3,"state":"open","created_at":"2015-03-30T12:54:05Z","updated_at":"2015-05-19T12:48:41Z","due_on":"2015-05-24T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389/commits","review_comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389/comments","review_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2389/comments","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/3938f6e0355eb11cf6f9f6d0c6d11e58849cfb6e","head":{"label":"mozilla:issue-2338-log-many-marketing-impressions","ref":"issue-2338-log-many-marketing-impressions","sha":"3938f6e0355eb11cf6f9f6d0c6d11e58849cfb6e","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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":11778024,"name":"fxa-content-server","full_name":"mozilla/fxa-content-server","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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/fxa-content-server","description":"Firefox Accounts Content Server","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-content-server","forks_url":"https://api.github.com/repos/mozilla/fxa-content-server/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-content-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-content-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-content-server/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-content-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-content-server/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-content-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-content-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-content-server/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-content-server/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-content-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-content-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-content-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-content-server/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-content-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-content-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-content-server/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-content-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-content-server/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-content-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-content-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-content-server/releases{/id}","created_at":"2013-07-30T23:35:35Z","updated_at":"2015-05-12T08:41:24Z","pushed_at":"2015-05-19T13:09:35Z","git_url":"git://github.com/mozilla/fxa-content-server.git","ssh_url":"git@github.com:mozilla/fxa-content-server.git","clone_url":"https://github.com/mozilla/fxa-content-server.git","svn_url":"https://github.com/mozilla/fxa-content-server","homepage":"","size":25151,"stargazers_count":64,"watchers_count":64,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":205,"forks":40,"open_issues":205,"watchers":64,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"5a015cc7f29deeb72da3f1616fad83b9a6a01f31","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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":11778024,"name":"fxa-content-server","full_name":"mozilla/fxa-content-server","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","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/fxa-content-server","description":"Firefox Accounts Content Server","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-content-server","forks_url":"https://api.github.com/repos/mozilla/fxa-content-server/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-content-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-content-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-content-server/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-content-server/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-content-server/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-content-server/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-content-server/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-content-server/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-content-server/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-content-server/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-content-server/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-content-server/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-content-server/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-content-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-content-server/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-content-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-content-server/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-content-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-content-server/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-content-server/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-content-server/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-content-server/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-content-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-content-server/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-content-server/releases{/id}","created_at":"2013-07-30T23:35:35Z","updated_at":"2015-05-12T08:41:24Z","pushed_at":"2015-05-19T13:09:35Z","git_url":"git://github.com/mozilla/fxa-content-server.git","ssh_url":"git@github.com:mozilla/fxa-content-server.git","clone_url":"https://github.com/mozilla/fxa-content-server.git","svn_url":"https://github.com/mozilla/fxa-content-server","homepage":"","size":25151,"stargazers_count":64,"watchers_count":64,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":205,"forks":40,"open_issues":205,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389"},"html":{"href":"https://github.com/mozilla/fxa-content-server/pull/2389"},"issue":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2389"},"comments":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/issues/2389/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/pulls/2389/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/fxa-content-server/statuses/3938f6e0355eb11cf6f9f6d0c6d11e58849cfb6e"}}}}