将Facebook广告预览iframe嵌入到Google幻灯片对话框中,使用Google Apps Script?

huangapple go评论63阅读模式
英文:

Embedding Facebook Ad Preview iframe to Google Slides Dialog Box using Google Apps Script?

问题

以下是翻译好的部分:

我有以下的端点:

https://graph.facebook.com/v16.0/${creativeId}/previews?ad_format=INSTAGRAM_STANDARD&access_token=${TOKEN}

它获取以下结果:

"<iframe src=\"https://www.facebook.com/ads/api/preview_iframe.php?d=AQIQOVf73lc6gE6oZk_KlQhYCyodDecQS2Ki8EVXur8CfNiuGySpoiBdsUkdXRaq3UlWgoIyN46_M1k05zrIBPAFS3AlLTYlznM095OJdK6T3dPhpXMGN5m-jaj27zMwURMeI9fLG5fXDd_6jOECJdvSktJk84ESLZfCiV-0n1az_2pBhi-DdsQxNlOT0fJImOlNKEwS3O8t2hZ5pRLJuKufc_LK5CaGgU866dwHwntEjVxRH6JHsBeG1ipj8gAf3gm_QVrSsBGEdb-JhV9NysDjf1GNc7ZLQCU4eL0Dm4sZJ3zxH0nQMvmSbaEYOT9DFSerAKHRmX5c6FQvwAP6ev_fFhqi3jujuX3nFxWfFSCXLgeRHf_Hd0fxvLdAecSecsTjKcsVRgPTKfbMp2JBdEWsHgFCnsl0-xL5KLsPmGMlQsaAtmubZHtmwpcutlCj9Cs&t=AQLQVw_wsM5j3L7j2YI\" width=\"320\" height=\"525\" scrolling=\"yes\" style=\"border: none;\"></iframe>

结果包含以下广告预览链接:
https://www.facebook.com/ads/api/preview_iframe.php?d=AQIWqcCZ4MvRL0Vs54fOKgjz_wqefwfmh6I0LDIUHt6ske4OIq-XVSvit7eMBIHiB-2heObno8DCpxSjQUmQSN5Ex1CQ8gJULFkCbn3lyli9b0r8wTzeOn_tBS1WyZU1EUfB16oJ--EZcTBhuP7sfBplKKTllnJMHHqcru-1VdCaVg4TM7hVwo2FHda8hgyHuQekSO_oEe1gmfZqhxRquLhZHnFVOyMIx2EBGAwhoJDMDAHbyJRrYas_kpiEnu386jbyo2S96XbXWuaPRo81WOq7JDtgQy4KEVCLZ8J1jjdD1s6Vm86oRYUqiHEG2seYrR3ZQq6W1dKs9XPnnJb_QQ7nBXtBqsObZXLGMCIvZMbNe_V7oOx-MqXandQWHL62fVaccEynk2h5VnJ6X3wWXC865OKjw3hCfy8PJ2R9PeuskqyAyR0yRg0QWA32g1x6j6s&amp&t=AQIvJJ9tem1--9rT7QE

是否有办法将上述广告预览创意嵌入Google幻灯片对话框?如果不行,是否有其他替代方案或解决方法?

感谢您的帮助。

英文:

I have the following endpoint:

https://graph.facebook.com/v16.0/${creativeId}/previews?ad_format=INSTAGRAM_STANDARD&access_token=${TOKEN}`

That fetches the following result:

"<iframe src=\"https://www.facebook.com/ads/api/preview_iframe.php?d=AQIQOVf73lc6gE6oZk_KlQhYCyodDecQS2Ki8EVXur8CfNiuGySpoiBdsUkdXRaq3UlWgoIyN46_M1k05zrIBPAFS3AlLTYlznM095OJdK6T3dPhpXMGN5m-jaj27zMwURMeI9fLG5fXDd_6jOECJdvSktJk84ESLZfCiV-0n1az_2pBhi-DdsQxNlOT0fJImOlNKEwS3O8t2hZ5pRLJuKufc_LK5CaGgU866dwHwntEjVxRH6JHsBeG1ipj8gAf3gm_QVrSsBGEdb-JhV9NysDjf1GNc7ZLQCU4eL0Dm4sZJ3zxH0nQMvmSbaEYOT9DFSerAKHRmX5c6FQvwAP6ev_fFhqi3jujuX3nFxWfFSCXLgeRHf_Hd0fxvLdAecSecsTjKcsVRgPTKfbMp2JBdEWsHgFCnsl0-xL5KLsPmGMlQsaAtmubZHtmwpcutlCj9Cs&t=AQLQVw_wsM5j3L7j2YI\" width=\"320\" height=\"525\" scrolling=\"yes\" style=\"border: none;\"></iframe>`

The results has the below ad preview url link:
https://www.facebook.com/ads/api/preview_iframe.php?d=AQIWqcCZ4MvRL0Vs54fOKgjz_wqefwfmh6I0LDIUHt6ske4OIq-XVSvit7eMBIHiB-2heObno8DCpxSjQUmQSN5Ex1CQ8gJULFkCbn3lyli9b0r8wTzeOn_tBS1WyZU1EUfB16oJ--EZcTBhuP7sfBplKKTllnJMHHqcru-1VdCaVg4TM7hVwo2FHda8hgyHuQekSO_oEe1gmfZqhxRquLhZHnFVOyMIx2EBGAwhoJDMDAHbyJRrYas_kpiEnu386jbyo2S96XbXWuaPRo81WOq7JDtgQy4KEVCLZ8J1jjdD1s6Vm86oRYUqiHEG2seYrR3ZQq6W1dKs9XPnnJb_QQ7nBXtBqsObZXLGMCIvZMbNe_V7oOx-MqXandQWHL62fVaccEynk2h5VnJ6X3wWXC865OKjw3hCfy8PJ2R9PeuskqyAyR0yRg0QWA32g1x6j6s&amp&t=AQIvJJ9tem1--9rT7QE

Is there a way to embed the above Ad preview creative in Google Slides Dialog Box ? If not, are there any alternatives or workarounds to do so ?

Thank you for your help.

答案1

得分: 1

I believe your goal is as follows.

  • You want to show &lt;iframe src=\&quot;https://www.facebook.com/,,,"></iframe>` to a dialog on Google Slides.

In this case, how about the following sample script?

Sample script:

Please copy and paste the following script to the script editor of Google Slides.

function sample() {
  // This value is from your question.
  const html = '&#39;&lt;iframe src=&quot;https://www.facebook.com/ads/api/preview_iframe.php?d=AQIQOVf73lc6gE6oZk_KlQhYCyodDecQS2Ki8EVXur8CfNiuGySpoiBdsUkdXRaq3UlWgoIyN46_M1k05zrIBPAFS3AlLTYlznM095OJdK6T3dPhpXMGN5m-jaj27zMwURMeI9fLG5fXDd_6jOECJdvSktJk84ESLZfCiV-0n1az_2pBhi-DdsQxNlOT0fJImOlNKEwS3O8t2hZ5pRLJuKufc_LK5CaGgU866dwHwntEjVxRH6JHsBeG1ipj8gAf3gm_QVrSsBGEdb-JhV9NysDjf1GNc7ZLQCU4eL0Dm4sZJ3zxH0nQMvmSbaEYOT9DFSerAKHRmX5c6FQvwAP6ev_fFhqi3jujuX3nFxWfFSCXLgeRHf_Hd0fxvLdAecSecsTjKcsVRgPTKfbMp2JBdEWsHgFCnsl0-xL5KLsPmGMlQsaAtmubZHtmwpcutlCj9Cs&amp;amp;t=AQLQVw_wsM5j3L7j2YI&quot; width=&quot;320&quot; height=&quot;525&quot; scrolling=&quot;yes&quot; style=&quot;border: none;&quot;&gt;&lt;/iframe&gt;&#39;;

  SlidesApp
    .getUi()
    .showModalDialog(
      HtmlService.createHtmlOutput(html)
        .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
        .setWidth(400)
        .setHeight(600),
      'sample'
    );
}

Testing:

When this script is run, the following result is obtained.

将Facebook广告预览iframe嵌入到Google幻灯片对话框中,使用Google Apps Script?

Note:

  • This is a sample script. So, please modify this to your actual situation.

  • If you want to show it in a sidebar, please modify as follows.

    • From

        SlidesApp.getUi().showModalDialog(HtmlService.createHtmlOutput(html).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL).setWidth(400).setHeight(600), 'sample');
      
    • To

        SlidesApp.getUi().showSidebar(HtmlService.createHtmlOutput(html).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL));
      

References:

英文:

I believe your goal is as follows.

  • You want to show &lt;iframe src=\&quot;https://www.facebook.com/,,,"></iframe>` to a dialog on Google Slides.

In this case, how about the following sample script?

Sample script:

Please copy and paste the following script to the script editor of Google Slides.

function sample() {
  // This value is from your question.
  const html = &#39;&lt;iframe src=&quot;https://www.facebook.com/ads/api/preview_iframe.php?d=AQIQOVf73lc6gE6oZk_KlQhYCyodDecQS2Ki8EVXur8CfNiuGySpoiBdsUkdXRaq3UlWgoIyN46_M1k05zrIBPAFS3AlLTYlznM095OJdK6T3dPhpXMGN5m-jaj27zMwURMeI9fLG5fXDd_6jOECJdvSktJk84ESLZfCiV-0n1az_2pBhi-DdsQxNlOT0fJImOlNKEwS3O8t2hZ5pRLJuKufc_LK5CaGgU866dwHwntEjVxRH6JHsBeG1ipj8gAf3gm_QVrSsBGEdb-JhV9NysDjf1GNc7ZLQCU4eL0Dm4sZJ3zxH0nQMvmSbaEYOT9DFSerAKHRmX5c6FQvwAP6ev_fFhqi3jujuX3nFxWfFSCXLgeRHf_Hd0fxvLdAecSecsTjKcsVRgPTKfbMp2JBdEWsHgFCnsl0-xL5KLsPmGMlQsaAtmubZHtmwpcutlCj9Cs&amp;amp;t=AQLQVw_wsM5j3L7j2YI&quot; width=&quot;320&quot; height=&quot;525&quot; scrolling=&quot;yes&quot; style=&quot;border: none;&quot;&gt;&lt;/iframe&gt;&#39;;

  SlidesApp
    .getUi()
    .showModalDialog(
      HtmlService.createHtmlOutput(html)
        .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
        .setWidth(400)
        .setHeight(600),
      &quot;sample&quot;
    );
}

Testing:

When this script is run, the following result is obtained.

将Facebook广告预览iframe嵌入到Google幻灯片对话框中,使用Google Apps Script?

Note:

  • This is a sample script. So, please modify this to your actual situation.

  • If you want to show it in a sidebar, please modify as follows.

    • From

        SlidesApp.getUi().showModalDialog(HtmlService.createHtmlOutput(html).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL).setWidth(400).setHeight(600), &quot;sample&quot;);
      
    • To

        SlidesApp.getUi().showSidebar(HtmlService.createHtmlOutput(html).setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL));
      

References:

huangapple
  • 本文由 发表于 2023年5月18日 07:34:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76276831.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定