Here you will learn how to install web push on your website so that it integrates with MTARGET. It is important to note that the steps written here may differ from those on your website system. However, this tutorial has been made as general as possible, so if there are differences when installing the code on the website system, we recommend contacting your technical team to install the web-push code.
Here are the steps for installing Web-Push:
- Go to the 'Campaign' > 'Push Campaign' menu.
- Click the 'Setting' button.
- Hover over the Web Push Script section. Here you will add 2 scripts, HTML and Javascript.
- Copy the HTML code to your web editor, then place the code in the header after the < head > tag (without spaces).
- Then, you need to install the javascript. The first option, you can directly import the file https://cdn.mtarget.co/release/mtt-sw.js into your serviceworker.js file. The second option, you can download the javascript file here. Then place the file in your root directory or public project with the file name serviceworker.js.
If all the above steps are met, you should have successfully installed the web-push script on the website. To check, you can do a hard reload (CTRL+F5) on your website. If an opt-in notification appears to block or allow, the script has been successfully installed.