如何使用Android Web View应用程序将标签添加到Onesignal中?

发布于 2025-02-09 21:50:00 字数 980 浏览 1 评论 0原文

我有一个已集成的Web View应用程序,并将其集成到其中。我要做的就是使用以下代码单击OneSignal中的按钮时向该用户添加标签:

<button onclick="buttonclicked()" >some</button>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
<script>
  window.OneSignal = window.OneSignal || [];
  OneSignal.push(function() {
    OneSignal.init({
      appId: "xxxxx",
    });
  });
  
  
function buttonclicked() {
    console.log("click");
    OneSignal.push(function() {
     OneSignal.sendTags({sub_url:window.location.href, topic:'tags'}).then(function(tagsSent) {
         console.log("tagssent:" + JSON.stringify(tagsSent));
     });
    });
}
</script>

我遵循与文档

不确定出了什么问题,当我通过应用程序触发函数时,数据不会被张贴到Oneignal的标签字段中。

任何帮助将不胜感激。

I have a web view app with OneSignal integrated into it. All I'm trying to do is add tags to that user when clicked on a button in OneSignal using the below code :

<button onclick="buttonclicked()" >some</button>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
<script>
  window.OneSignal = window.OneSignal || [];
  OneSignal.push(function() {
    OneSignal.init({
      appId: "xxxxx",
    });
  });
  
  
function buttonclicked() {
    console.log("click");
    OneSignal.push(function() {
     OneSignal.sendTags({sub_url:window.location.href, topic:'tags'}).then(function(tagsSent) {
         console.log("tagssent:" + JSON.stringify(tagsSent));
     });
    });
}
</script>

I followed exactly the same procedure as in the documentation

Not sure what went wrong, when I trigger the function through the app, the data is not being posted to OneSignal's tags field.

Any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文