简体   繁体   English

最新通知警报

[英]Latest Notification alerts

I am using https://www.moengage.com/ to generate the smart trigger campaign notification alert for my users for desktop and mobile. 我正在使用https://www.moengage.com/为台式机和移动设备的用户生成智能触发活动通知警报。 using their <link rel="manifest" href="manifest.json"> 使用他们的<link rel="manifest" href="manifest.json">

<script type="text/javascript">
(function(i,s,o,g,r,a,m,n){
i['moengage_object']=r;t={}; q = function(f){return function(){(i['moengage_q']=i['moengage_q']||[]).push({f:f,a:arguments});};};
f = ['track_event','add_user_attribute','add_first_name','add_last_name','add_email','add_mobile',
'add_user_name','add_gender','add_birthday','destroy_session','add_unique_user_id','moe_events','call_web_push','track','location_type_attribute'];
for(k in f){t[f[k]]=q(f[k]);}
a=s.createElement(o);m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);
i['moe']=i['moe'] || function(){n=arguments[0];return t;}; a.onload=function(){if(n){i[r] = moe(n);}};
})(window,document,'script','https://cdn.moengage.com/webpush/moe_webSdk.min.latest.js','Moengage'); 

Moengage = moe({
  app_id:"MyAppID",
  debug_logs: 0
}); 
</script>

campaign is created and I can view the notification alert pop up but when I click "allow" it is not throwing the notifications. 广告系列已创建,我可以查看弹出的通知警报,但是当我单击“允许”时,它不会引发通知。

how do I solve this ? 我该如何解决?

Hi I work at MoEngage currently. 嗨,我目前在MoEngage工作。 Smart Triggers are not instantaneous. 智能触发器不是瞬时的。 There is a processing time of about 5 minutes before the notification is sent out. 发出通知之前,大约需要5分钟的处理时间。 What you can do instead is wait for our callback event (docs -> https://docs.moengage.com/docs/tracking-opt-ins-on-your-own#section-this-is-how-you-can-add-listeners-for-the-events-mentioned-above- ) and show a welcome notification by javascript. 相反,您可以做的是等待我们的回调事件(docs-> https://docs.moengage.com/docs/tracking-opt-ins-on-your-own#section-this-is-how-you-can -添加提及上述事件的侦听器 ),并通过javascript显示欢迎通知。

 ... else if (e.detail == "opt_in_allowed") { spawnNotification(); } ... function spawnNotification() { var title = "Your title"; var body = "Your body"; var icon = "https://path.to.your/icon/file"; var options = { body: body, icon: icon }; navigator.serviceWorker.ready.then(function(sw_reg) { var n = sw_reg.showNotification(title, options); }).catch(function(e) { console.log(e); }); } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM