How to Install a Web Push Script

Here you will learn about how to install web push on your web to integrate with MTARGET. It is important to know, the steps written here may be different 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 engineering team to help install the web-push code.

Here are the steps for a Web-Push installation:

  1. Enter the ‘Push Campaign’ menu.
  2. Click the ‘Settings’ button.
  3. Scroll to the Web Push Script section. Here you will add 2 scripts, HTML and Javascript.
  4. In the first, you will be installing the HTML code into your web editor. Copy the code, then paste HTML code to header after < head > tag (No spaces).
  5. Second, you will install javascript. There are two ways here to install javascript,
    • Create a file manually with the name mtt-sw.js, then copy the js code and paste to your file mtt-sw.js.
    • If the first method fails to load, download the serviceworker.js here file, then save.

Put this .js file in the root or public directory on your website.

If all the steps above have been fulfilled, you should have successfully installed the web-push script on your website. To check it, 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.

Was this article helpful?
Let's See How They Improved By Using Our Products
They are using our product and success to run 2500%+ ROI Campaigns, increase their revenue through personalization, and many other benefit. Check their stories


The latest tutorials sent straight to your inbox.