Merhabalar,
OneSignal kodu ekleyeceğim isteme. Multi site olduğu için aynı kodu özelleştirerek farklı sayfalara farklı şekilde eklemem gerekiyor.
Sitemi eklediğimde bana verdiği
<script> tagı ile birlikte eklemem gereken kod:
<script>
var OneSignal = window.OneSignal || [];
OneSignal.push(function() {
OneSignal.init({
appId: "xxxxx-xxx-xxxx-a92d-xxxxxxx",
autoRegister: false,
notifyButton: {
enable: true,
},
});
});
</script>Kodu özelleştirebilmek için örnek olarak gösterilen kod:
// Do NOT call init() twice
OneSignal.push(["init", {
/* Your other init options here */
promptOptions: {
customlink: {
enabled: true, /* Required to use the Custom Link */
style: "button", /* Has value of 'button' or 'link' */
size: "medium", /* One of 'small', 'medium', or 'large' */
color: {
button: '#E12D30', /* Color of the button background if style = "button" */
text: '#FFFFFF', /* Color of the prompt's text */
},
text: {
subscribe: "Subscribe to push notifications", /* Prompt's text when not subscribed */
unsubscribe: "Unsubscribe from push notifications", /* Prompt's text when subscribed */
explanation: "Get updates from all sorts of things that matter to you", /* Optional text appearing before the prompt button */
},
unsubscribeEnabled: true, /* Controls whether the prompt is visible after subscription */
}
}
}]);Verdiği bu kodu ilk koda nasıl entegre etmem gerekiyor?