Wistia Javascript API -转换事件重定向到确认页面

Wistia Javascript API - conversion event to redirect to a confirmation page

本文关键字:确认 重定向 事件 Javascript API 转换 Wistia      更新时间:2023-09-26

我正在使用Wistia的Turnstile来捕捉视频末尾的电子邮件。问题是,我想在用户点击提交后重定向到另一个页面。该消息将要求检查电子邮件以确认双重选择。

我尝试使用2种嵌入类型,但没有成功。

IFrame:

<iframe src="//fast.wistia.net/embed/iframe/7zu6ze7v40?videoFoam=true" allowtransparency="true" frameborder="0" scrolling="yes" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen id="my_wistia_video"></iframe>
<script src="//fast.wistia.net/assets/external/iframe-api-v1.js"></script>
<script>
  wistiaEmbed = document.getElementById("my_wistia_video").wistiaApi;
  wistiaEmbed.bind("conversion", function(type, val) {
  window.location.href == "http://the_page";
});
</script>
API:

<div id="wistia_7zu6ze7v40" class="wistia_embed" style="width:640px;height:508px;">&nbsp;</div>
<script charset="ISO-8859-1" src="//fast.wistia.com/assets/external/E-v1.js"></script>
<script>
  wistiaEmbed = Wistia.embed("7zu6ze7v40", {
    videoFoam: true
  });
  wistiaEmbed.bind("conversion", function(type, val) {
    window.location.href == "http://the_page";
  });
</script>

有什么提示或建议吗?

看起来您正在使用==的比较运算符(布尔运算符),并且您将希望在该位置使用单个=来简单地设置示例中的window.location.href。如果您对比较运算符的更多信息感到好奇,请查看W3页面。

无论如何,我推荐这个嵌入:

<div id="wistia_7zu6ze7v40" class="wistia_embed" style="width:640px;height:508px;">&nbsp;</div>
<script charset="ISO-8859-1" src="//fast.wistia.com/assets/external/E-v1.js"></script>
<script>
  wistiaEmbed = Wistia.embed("7zu6ze7v40", {
videoFoam: true
  });
  wistiaEmbed.bind("conversion", function(type, val) {
    window.location.href = "http://the_page";
  });
</script>

我找不到问题的答案,但我用另一种可能更好的方法解决了这个问题。

这个想法是在视频所在的页面上包含一个表单,并且仅在视频结束时显示该表单。表单的div必须有一个"display: none;",下面的代码将使它在视频结束时出现:
<script>
  wistiaEmbed = document.getElementById("my_wistia_video").wistiaApi;
  wistiaEmbed.bind("end", function() {  
    document.getElementById("div_id").style.display = 'block';
  });
</script>

在这种情况下,我停止使用turnstile。虽然我认为编辑视频可能是另一种解决方案,但我正在使用行动呼吁。