The following guide describes what a typical implementation looks like. It's possible that your web configuration is slightly different. If you require additional assistance, let us know - we have tech support available to speak with you.
What you need
IMPORTANT - Your account manager will provide you with a Partner ID. Use this ID in both the Page Script and Service Worker where you see [YOUR-PARTNER-ID]. Replace brackets and text.
Page Script:
<script> (function(document, window) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://trk-syntrex.com/scripts/push/script/[YOUR-PARTNER-ID]?url=" + encodeURI(self.location.hostname) + "&alturl=" + encodeURI(self.location.pathname);
script.onload = function() {
push_init();
push_subscribe();
};
document.getElementsByTagName("head")[0].appendChild(script);
})(document, window); </script>
Service Worker:
Create a JS file named service-worker.js with the following contents:
importScripts("https://trk-syntrex.com/scripts/sw/script/[YOUR-PARTNER-ID]?url="+encodeURI(self.location.hostname));IMPORTANT - Your account manager will provide you with a Partner ID. Use this ID in both the Page Script and Service Worker where you see [YOUR-PARTNER-ID]. Replace brackets and text.
Installation Steps
1. Place the Page Script on your web pages. For easy deployment it is usually placed in the <head> section of the website. Alternatively, it can be placed within the <body>.
(above screenshot is for example purposes, actual script src and partner ID will differ on your setup)
2. Place the service-worker.js file in the root directory of your website.
You can verify that you've done this correctly by checking to see if it's available: https://yourdomain.com/service-worker.js
Things to know:
- Web page must be secure (SSL)
- Opt-in dialog will not display when using an incognito/private window
- Chrome 80 will quietly set push permissions to ‘block’ after several page reloads where the opt-in dialog is ignored by the user. Clear browser cache or click the lock icon (in the address bar) to reset this behavior.