how to integrate in web
Welcome to the guide on integrating pushmarket.io with website. We will provide you complete guide
1. create a project
- Go to docs.pushmarket.io/projects  and follow the instructions to create a new project.
- Get project id from your project dashboard settings.
projects > {{projectId}} > settings
2. Add script to your website
To add pushmarket.io to your website, you need to include the following script below body tags and replace {{projectId}}
with your project id.
<script type="text/javascript" src="https://pushmarket.io/sdk/pushmarket-io.js?projectId={{projectId}}"></script>
3. Create a new javascript file
Create a new javascript file, called sw.js
and add the following code to it. make sure that this js file follow this directory structure (https://www.example.com/sw.js ).
sw.js
importScripts("https://pushmarket.io/sdk/service-worker.js")
Example
I am assuming this is the project Id
11a67c1a-0588-4b85-8314-a05d3b979008
- Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script type="text/javascript" src="https://pushmarket.io/sdk/pushmarket-io.js?projectId=11a67c1a-0588-4b85-8314-a05d3b979008"></script>
</html>
Last updated on