• Resolved sally

    (@sallyruchman)


    Hello,

    I added the script to my Homepage to prompt the users after the 3rd Page visit.

    When I test I get offered the native Prompt for subscribing, but I would like to have the Onesignal Show Slide down prompt shown ???

    Can someone give me a hint please ?

    Thx
    Best regards
    Sally

    <script src=”https://cdn.onesignal.com/sdks/OneSignalSDK.js&#8221; async=””></script>
    <script>
    var OneSignal = window.OneSignal || [];
    /* Why use .push? See: https://stackoverflow.com/a/38466780/555547 */
    OneSignal.push(function() {
    OneSignal.init({
    appId: “0000000000000000000000”,
    });
    });
    </script>
    <!– data-cfasync: Ignore CloudFlare’s Rocket Loader, which may impact the triggering of the DOMContentLoaded event (see: https://goo.gl/CvZewv) –>
    <script data-cfasync=”false”>
    window.OneSignal = window.OneSignal || [];
    var numVisitsTrigger = 3; /* Number of page visits before prompting user */

    /* Why use .push? See: https://stackoverflow.com/a/38466780/555547 */
    window.OneSignal.push(function() {
    var numVisits = new Number(localStorage[‘numVisitsTrigger’] || 0);
    numVisits += 1;
    localStorage[‘numVisitsTrigger’] = numVisits;
    if (numVisits >= numVisitsTrigger) {
    promptAndSubscribeUser();
    }
    });

    function promptAndSubscribeUser() {
    /* Want to trigger different permission messages? See: https://documentation.onesignal.com/docs/permission-requests#section-onesignal-permission-messages */
    window.OneSignal.isPushNotificationsEnabled(function(isEnabled) {
    if (!isEnabled) {
    window.OneSignal.showNativePrompt();
    }
    });
    }
    </script>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘OneSignal SlidePrompt via Script’ is closed to new replies.