{"action":"created","issue":{"url":"https://api.github.com/repos/ampproject/amphtml/issues/1524","labels_url":"https://api.github.com/repos/ampproject/amphtml/issues/1524/labels{/name}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/1524/comments","events_url":"https://api.github.com/repos/ampproject/amphtml/issues/1524/events","html_url":"https://github.com/ampproject/amphtml/issues/1524","id":128129798,"number":1524,"title":"Forcing one amp-ad to be the master","user":{"login":"jdelhommeau","id":14938467,"avatar_url":"https://avatars.githubusercontent.com/u/14938467?v=3","gravatar_id":"","url":"https://api.github.com/users/jdelhommeau","html_url":"https://github.com/jdelhommeau","followers_url":"https://api.github.com/users/jdelhommeau/followers","following_url":"https://api.github.com/users/jdelhommeau/following{/other_user}","gists_url":"https://api.github.com/users/jdelhommeau/gists{/gist_id}","starred_url":"https://api.github.com/users/jdelhommeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdelhommeau/subscriptions","organizations_url":"https://api.github.com/users/jdelhommeau/orgs","repos_url":"https://api.github.com/users/jdelhommeau/repos","events_url":"https://api.github.com/users/jdelhommeau/events{/privacy}","received_events_url":"https://api.github.com/users/jdelhommeau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-22T10:47:00Z","updated_at":"2016-01-22T13:10:49Z","closed_at":null,"body":"Hi Guys,\r\n\r\nI am currently working on the amp adaptor for appnexus adserver.\r\nWe want to support one ad call for every ad placement on the page, which require communicating among the different amp-ad tags on the page.\r\n\r\nThe idea is that the master iframe will make the ad call for every placements on the page. Then every slave iframe will ask the master iframe to give them the ad code to render.\r\nIt works fine, however, as it seems the master iframe change every time we refresh the page, we need to pass the configuration for all placements in every amp-ad tag, rather than only passing it to the master (as we don't know in advance which one will be the master).\r\n\r\nIs there a way to either force or know in advance which amp-ad will be the master?\r\n\r\nTo give you a better idea of the problem, here is the code to setup two ads:\r\n\r\n```\r\n\r\n<!doctype html>\r\n<html ⚡>\r\n  <head>\r\n    <meta charset=\"utf-8\">\r\n    <link rel=\"canonical\" href=\"hello-world.html\" >\r\n    <meta name=\"viewport\" content=\"width=device-width,minimum-scale=1,initial-scale=1\">\r\n    <style>body {opacity: 0}</style><noscript><style>body {opacity: 1}</style></noscript>\r\n    <script async src=\"https://cdn.ampproject.org/v0.js\"></script>\r\n  </head>\r\n<body>\r\n  <amp-ad width=300 height=250\r\n      type=\"appnexusast\"\r\n\t  data-target=\"apn_ad_40954389058\"\r\n\t  json='{\"pageOpts\":{\"member\": 958}, \"adUnits\": [{\"member\": 958,\"invCode\": \"ast_guaranteed_prios_1\",\"sizes\": [300,250],\"targetId\": \"apn_ad_40954389058\"}, {\"member\": 958, \"invCode\": \"ast_guaranteed_prios_1\",\"sizes\": [160,600],\"targetId\":\"apn_ad_5675675648\"}]}'>\r\n  </amp-ad>\r\n  <amp-ad width=160 height=600\r\n      type=\"appnexusast\"\r\n\t  data-target=\"apn_ad_5675675648\"\r\n\t  json='{\"pageOpts\":{\"member\": 958}, \"adUnits\": [{\"member\": 958,\"invCode\": \"ast_guaranteed_prios_1\",\"sizes\": [300,250],\"targetId\": \"apn_ad_40954389058\"}, {\"member\": 958, \"invCode\": \"ast_guaranteed_prios_1\",\"sizes\": [160,600],\"targetId\":\"apn_ad_5675675648\"}]}'>\r\n  </amp-ad>\r\n\r\n</body>\r\n</html>\r\n```\r\n\r\n\r\nWhat we would like to have is this:\r\n\r\n```\r\n\r\n<!doctype html>\r\n<html ⚡>\r\n  <head>\r\n    <meta charset=\"utf-8\">\r\n    <link rel=\"canonical\" href=\"hello-world.html\" >\r\n    <meta name=\"viewport\" content=\"width=device-width,minimum-scale=1,initial-scale=1\">\r\n    <style>body {opacity: 0}</style><noscript><style>body {opacity: 1}</style></noscript>\r\n    <script async src=\"https://cdn.ampproject.org/v0.js\"></script>\r\n  </head>\r\n<body>\r\n  <amp-ad width=300 height=250\r\n      type=\"appnexusast\"\r\n\t  data-target=\"apn_ad_40954389058\"\r\n\t  json='{\"pageOpts\":{\"member\": 958}, \"adUnits\": [{\"member\": 958,\"invCode\": \"ast_guaranteed_prios_1\",\"sizes\": [300,250],\"targetId\": \"apn_ad_40954389058\"}, {\"member\": 958, \"invCode\": \"ast_guaranteed_prios_1\",\"sizes\": [160,600],\"targetId\":\"apn_ad_5675675648\"}]}'>\r\n  </amp-ad>\r\n  <amp-ad width=160 height=600\r\n      type=\"appnexusast\"\r\n\t  data-target=\"apn_ad_5675675648\">\r\n  </amp-ad>\r\n\r\n</body>\r\n</html>\r\n```\r\n\r\nThank you for your help.\r\n\r\nJulien"},"comment":{"url":"https://api.github.com/repos/ampproject/amphtml/issues/comments/173916619","html_url":"https://github.com/ampproject/amphtml/issues/1524#issuecomment-173916619","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/1524","id":173916619,"user":{"login":"cramforce","id":89679,"avatar_url":"https://avatars.githubusercontent.com/u/89679?v=3","gravatar_id":"","url":"https://api.github.com/users/cramforce","html_url":"https://github.com/cramforce","followers_url":"https://api.github.com/users/cramforce/followers","following_url":"https://api.github.com/users/cramforce/following{/other_user}","gists_url":"https://api.github.com/users/cramforce/gists{/gist_id}","starred_url":"https://api.github.com/users/cramforce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cramforce/subscriptions","organizations_url":"https://api.github.com/users/cramforce/orgs","repos_url":"https://api.github.com/users/cramforce/repos","events_url":"https://api.github.com/users/cramforce/events{/privacy}","received_events_url":"https://api.github.com/users/cramforce/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T13:10:49Z","updated_at":"2016-01-22T13:10:49Z","body":"There is currently no way to uncouple configuration from placement on the\npage. I think that would be an interesting enhancement, but it would take\nin the order of 4-5 weeks to fully land (due to validation changes, etc.).\nOn Jan 22, 2016 5:07 AM, \"jdelhommeau\" <notifications@github.com> wrote:\n\n> Thank you @cramforce <https://github.com/cramforce> , that makes sense.\n> In that case, is there a way to make a third element, containing the\n> configuration, always load, ideally first, and have the two amp-ad tags\n> only display the ad (not making any call) whenever they need it?\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/ampproject/amphtml/issues/1524#issuecomment-173915894>\n> .\n>\n"}}