{"action":"created","comment":{"url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/comments/27821954","id":27821954,"diff_hunk":"@@ -234,6 +235,36 @@ def update_flight(link, campaign, az_campaign):\n             'RateType': 1, # 1: Flat\n         })\n \n+    if campaign.mobile_os:\n+        deviceQueries = ['($device.os contains \"%s\")' % os\n+                         for os in campaign.mobile_os]\n+\n+        if campaign.platform == \"all\":\n+            deviceQueries.append('($device.formFactor contains \"desktop\")')\n+        \n+        customTargeting = ' or '.join(deviceQueries)\n+        d.update({\n+            'CustomTargeting': customTargeting,\n+        })\n+\n+    if campaign.platform != 'all':\n+        siteZones = []\n+        if campaign.platform == 'desktop':\n+            siteZones.append({\n+                'SiteId': g.az_selfserve_site_id,\n+                'IsExclude': False,\n+            })\n+        elif campaign.platform == 'mobile':\n+            siteZones.append({\n+                'SiteId': g.az_selfserve_mobile_web_site_id,\n+                'IsExclude': False,\n+            })\n+\n+        if len(siteZones):\n+            d.update({\n+                'SiteZoneTargeting': siteZones","path":"reddit_adzerk/adzerkpromote.py","position":39,"original_position":39,"commit_id":"854c0f4f6cbf12881e0db6fc2eab7eba1dbedc62","original_commit_id":"854c0f4f6cbf12881e0db6fc2eab7eba1dbedc62","user":{"login":"madbook","id":2260961,"avatar_url":"https://avatars.githubusercontent.com/u/2260961?v=3","gravatar_id":"","url":"https://api.github.com/users/madbook","html_url":"https://github.com/madbook","followers_url":"https://api.github.com/users/madbook/followers","following_url":"https://api.github.com/users/madbook/following{/other_user}","gists_url":"https://api.github.com/users/madbook/gists{/gist_id}","starred_url":"https://api.github.com/users/madbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madbook/subscriptions","organizations_url":"https://api.github.com/users/madbook/orgs","repos_url":"https://api.github.com/users/madbook/repos","events_url":"https://api.github.com/users/madbook/events{/privacy}","received_events_url":"https://api.github.com/users/madbook/received_events","type":"User","site_admin":false},"body":"yup!","created_at":"2015-04-06T19:22:14Z","updated_at":"2015-04-06T19:22:14Z","html_url":"https://github.com/reddit/reddit-plugin-adzerk/pull/59#discussion_r27821954","pull_request_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59","_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/comments/27821954"},"html":{"href":"https://github.com/reddit/reddit-plugin-adzerk/pull/59#discussion_r27821954"},"pull_request":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59"}}},"pull_request":{"url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59","id":32065662,"html_url":"https://github.com/reddit/reddit-plugin-adzerk/pull/59","diff_url":"https://github.com/reddit/reddit-plugin-adzerk/pull/59.diff","patch_url":"https://github.com/reddit/reddit-plugin-adzerk/pull/59.patch","issue_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues/59","number":59,"state":"open","locked":false,"title":"Use platform and mobile OS targeting.","user":{"login":"madbook","id":2260961,"avatar_url":"https://avatars.githubusercontent.com/u/2260961?v=3","gravatar_id":"","url":"https://api.github.com/users/madbook","html_url":"https://github.com/madbook","followers_url":"https://api.github.com/users/madbook/followers","following_url":"https://api.github.com/users/madbook/following{/other_user}","gists_url":"https://api.github.com/users/madbook/gists{/gist_id}","starred_url":"https://api.github.com/users/madbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madbook/subscriptions","organizations_url":"https://api.github.com/users/madbook/orgs","repos_url":"https://api.github.com/users/madbook/repos","events_url":"https://api.github.com/users/madbook/events{/privacy}","received_events_url":"https://api.github.com/users/madbook/received_events","type":"User","site_admin":false},"body":"for platform targeting, pass along the appropriate site id.  for os targeting, we need to add a custom targeting 'zerkel' query to the flight and pass the user agent along when making the request.  I have _not_ tested this on stagin yet (going to try to get to that today).\r\n\r\n:eyeglasses: @bsimpson63 ","created_at":"2015-03-26T21:59:42Z","updated_at":"2015-04-06T19:22:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"799481673cb620083a685738dd21a9f19b035d28","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59/commits","review_comments_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59/comments","review_comment_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues/59/comments","statuses_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/statuses/854c0f4f6cbf12881e0db6fc2eab7eba1dbedc62","head":{"label":"madbook:add-mobile-web-targeting","ref":"add-mobile-web-targeting","sha":"854c0f4f6cbf12881e0db6fc2eab7eba1dbedc62","user":{"login":"madbook","id":2260961,"avatar_url":"https://avatars.githubusercontent.com/u/2260961?v=3","gravatar_id":"","url":"https://api.github.com/users/madbook","html_url":"https://github.com/madbook","followers_url":"https://api.github.com/users/madbook/followers","following_url":"https://api.github.com/users/madbook/following{/other_user}","gists_url":"https://api.github.com/users/madbook/gists{/gist_id}","starred_url":"https://api.github.com/users/madbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madbook/subscriptions","organizations_url":"https://api.github.com/users/madbook/orgs","repos_url":"https://api.github.com/users/madbook/repos","events_url":"https://api.github.com/users/madbook/events{/privacy}","received_events_url":"https://api.github.com/users/madbook/received_events","type":"User","site_admin":false},"repo":{"id":23370563,"name":"reddit-plugin-adzerk","full_name":"madbook/reddit-plugin-adzerk","owner":{"login":"madbook","id":2260961,"avatar_url":"https://avatars.githubusercontent.com/u/2260961?v=3","gravatar_id":"","url":"https://api.github.com/users/madbook","html_url":"https://github.com/madbook","followers_url":"https://api.github.com/users/madbook/followers","following_url":"https://api.github.com/users/madbook/following{/other_user}","gists_url":"https://api.github.com/users/madbook/gists{/gist_id}","starred_url":"https://api.github.com/users/madbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madbook/subscriptions","organizations_url":"https://api.github.com/users/madbook/orgs","repos_url":"https://api.github.com/users/madbook/repos","events_url":"https://api.github.com/users/madbook/events{/privacy}","received_events_url":"https://api.github.com/users/madbook/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/madbook/reddit-plugin-adzerk","description":"reddit plugin for adzerk-hosted adverts","fork":true,"url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk","forks_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/forks","keys_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/teams","hooks_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/hooks","issue_events_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/issues/events{/number}","events_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/events","assignees_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/assignees{/user}","branches_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/branches{/branch}","tags_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/tags","blobs_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/git/refs{/sha}","trees_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/statuses/{sha}","languages_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/languages","stargazers_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/stargazers","contributors_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/contributors","subscribers_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/subscribers","subscription_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/subscription","commits_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/commits{/sha}","git_commits_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/git/commits{/sha}","comments_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/comments{/number}","issue_comment_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/issues/comments{/number}","contents_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/contents/{+path}","compare_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/merges","archive_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/downloads","issues_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/issues{/number}","pulls_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/pulls{/number}","milestones_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/milestones{/number}","notifications_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/labels{/name}","releases_url":"https://api.github.com/repos/madbook/reddit-plugin-adzerk/releases{/id}","created_at":"2014-08-26T23:47:14Z","updated_at":"2014-09-15T20:31:30Z","pushed_at":"2015-04-06T19:08:35Z","git_url":"git://github.com/madbook/reddit-plugin-adzerk.git","ssh_url":"git@github.com:madbook/reddit-plugin-adzerk.git","clone_url":"https://github.com/madbook/reddit-plugin-adzerk.git","svn_url":"https://github.com/madbook/reddit-plugin-adzerk","homepage":"","size":223,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"reddit:master","ref":"master","sha":"9c70deb4a91176d5435c803b834f8b22d0da7e0e","user":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"repo":{"id":7122209,"name":"reddit-plugin-adzerk","full_name":"reddit/reddit-plugin-adzerk","owner":{"login":"reddit","id":14248,"avatar_url":"https://avatars.githubusercontent.com/u/14248?v=3","gravatar_id":"","url":"https://api.github.com/users/reddit","html_url":"https://github.com/reddit","followers_url":"https://api.github.com/users/reddit/followers","following_url":"https://api.github.com/users/reddit/following{/other_user}","gists_url":"https://api.github.com/users/reddit/gists{/gist_id}","starred_url":"https://api.github.com/users/reddit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddit/subscriptions","organizations_url":"https://api.github.com/users/reddit/orgs","repos_url":"https://api.github.com/users/reddit/repos","events_url":"https://api.github.com/users/reddit/events{/privacy}","received_events_url":"https://api.github.com/users/reddit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reddit/reddit-plugin-adzerk","description":"reddit plugin for adzerk-hosted adverts","fork":false,"url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk","forks_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/forks","keys_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/teams","hooks_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/hooks","issue_events_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues/events{/number}","events_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/events","assignees_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/assignees{/user}","branches_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/branches{/branch}","tags_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/tags","blobs_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/git/refs{/sha}","trees_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/statuses/{sha}","languages_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/languages","stargazers_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/stargazers","contributors_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/contributors","subscribers_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/subscribers","subscription_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/subscription","commits_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/commits{/sha}","git_commits_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/git/commits{/sha}","comments_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/comments{/number}","issue_comment_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues/comments{/number}","contents_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/contents/{+path}","compare_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/merges","archive_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/downloads","issues_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues{/number}","pulls_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls{/number}","milestones_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/milestones{/number}","notifications_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/labels{/name}","releases_url":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/releases{/id}","created_at":"2012-12-12T00:59:20Z","updated_at":"2015-03-26T17:59:19Z","pushed_at":"2015-04-06T19:08:35Z","git_url":"git://github.com/reddit/reddit-plugin-adzerk.git","ssh_url":"git@github.com:reddit/reddit-plugin-adzerk.git","clone_url":"https://github.com/reddit/reddit-plugin-adzerk.git","svn_url":"https://github.com/reddit/reddit-plugin-adzerk","homepage":"","size":723,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":2,"forks":9,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59"},"html":{"href":"https://github.com/reddit/reddit-plugin-adzerk/pull/59"},"issue":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues/59"},"comments":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/issues/59/comments"},"review_comments":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59/comments"},"review_comment":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/pulls/59/commits"},"statuses":{"href":"https://api.github.com/repos/reddit/reddit-plugin-adzerk/statuses/854c0f4f6cbf12881e0db6fc2eab7eba1dbedc62"}}}}