Created
June 28, 2018 07:59
-
-
Save themodernpk/d252b9f715994b82d2663b5bb2328a66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script> | |
<script> | |
var OneSignal_player_id; | |
var OneSignal = window.OneSignal || []; | |
OneSignal.push(["init", { | |
appId: "<?php echo env('ONESIGNAL_APP_ID') ?>", | |
autoRegister: true, | |
notifyButton: { | |
enable: true | |
} | |
}]); | |
OneSignal.push(function() { | |
OneSignal.showHttpPrompt(); | |
}); | |
OneSignal.push(function() { | |
OneSignal.getUserId(function(userId) | |
{ | |
console.log("one signal-->", userId); | |
OneSignal.sendTag('{{env('APP_SHORT_NAME')}}-user-id', {{\Auth::user()->id}}); | |
OneSignal_player_id = userId; | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment