Adding the JavaScript snippet to your page
Last updated
<script type="text/javascript">
(function(b,a,t,c,h,e,r){h='batchSDK';b[h]=b[h]||function() {
(b[h].q=b[h].q||[]).push(arguments)};e=a.createElement(t),r=a.getElementsByTagName(t)[0];
e.async=1;e.src=c;r.parentNode.insertBefore(e,r);})(window,document,'script','https://via.batch.com/v4/bootstrap.min.js');
var batchSDKUIConfig = {
native: {}
};
/* Use a specific configuration for Firefox and Safari browsers (custom prompt) */
if (navigator.userAgent.indexOf("Firefox") !== -1 || (navigator.userAgent.indexOf("Safari") !== -1 &&
navigator.userAgent.indexOf("Chrome") === -1)) {
batchSDKUIConfig = {
alert: {
text: "Get notified about updates!", // TODO ๐ถ Update to contextualize subscription request
positiveSubBtnLabel: "Subscribe", // TODO ๐ถ Update positiveSubBtnLabel value
negativeBtnLabel: "No thanks", // TODO ๐ถ Update negativeBtnLabel value
positiveBtnStyle: {
shadow: true,
backgroundColor: "#3996bb", // TODO ๐ถ Update button color
hoverBackgroundColor: "#289e9c", // TODO ๐ถ Update button hover color
textColor: "black" // TODO ๐ถ Update button text color
}
}
}
}
/* Finalize the Batch SDK setup */
batchSDK('setup', {
apiKey: 'A2F106415282499FACJE83M281F943F8',
subdomain: 'batchtest',
authKey: '2.kMo10GzeBVIgUDnlADeuIIbq0ud0+BaYLzjEZyK99Eo=',
vapidPublicKey: 'BJ1gQdN6x2j0WjCQIqlLHyx00TrXM3LPoJugVoT6fGedCFyk0LOYX3Z0ki1OyKI/ajkouunydmSyM2mCX4dnuxQ=',
ui: batchSDKUIConfig,
safari: {"https://mywebsiteurl.com":""}
});
/* Optional: override user country/language */
/*
batchSDK(async api => {
const profile = await api.profile();
await profile.edit(editor => {
editor
.setLanguage("en") // TODO ๐ถ set user language
.setRegion("EN") // TODO ๐ถ set user country
})
});
*/
/* Optional: Log in */
/*
batchSDK(async api => {
const profile = await api.profile();
await profile.identify({customId: "custom_user_id"}); // TODO ๐ถ set user Custom User ID
});
*/
/* Optional: Log out */
/*
batchSDK(async api => {
const profile = await api.profile();
await profile.identify(null);
});
*/
</script>