简体   繁体   中英

Asp.net c# How to update Onesignal tags on asp.net page?

I'm new to Onesignal.com push notifications, I manage to add it to my asp.net site,my problem is does anyone knows if and how I can change the user tags with the Api, for register user. One more, now I add the javascript code and when user comes to my page he can register throw the popup modal, I want to know if there is a way to register with a button click event with the api

I'll be thankful for c# code example

Thanks in advance

The easiest way to set tags on a website is to use the OneSignal Javascript SendTags method.

You can call OneSignal.push(["sendTags", {key2: "value2", key3: "value3"}]) any time after var OneSignal = OneSignal || []; var OneSignal = OneSignal || [];

To trigger the permission event from a button link, you should use the registerForPushNotifications method. For example (inside of the click event handler):

OneSignal.push(function() {
  OneSignal.registerForPushNotifications();
});`

Note that you should first set autoRegister to false in the init method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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