如何使用Android Web View应用程序将标签添加到Onesignal中?
我有一个已集成的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论