There are two steps to integrate Truepush with Blogger web service for the HTTPS website.
STEP 1– Download Sw.js file
STEP 2– Place SDK code
Note: If you are using an HTTP website, directly jump to step 2 in HTTPS.
STEP 1: Download Sw.js file
The integration of Truepush with your website requires you to place Truepush script in the body section and sw.js in the root folder of the website, both are present on the app. The instruction to upload the sw.js file usually depends on your hosting provider. For the HTTPS website, the sw.js can be uploaded only if you have access to your cPanel or the server.
1.1 FTP or SFTP into your server and navigate to where your site is installed.
1.2 Go to Truepush and register for free with name, email, and password.
1.3 Once you are signed up, you’ll see the project creation page.
a) Enter the name of your project. For example, your website name, or any preferred name you would like.
b) Select the ‘Web option’ as highlighted in the image below.
1.4 Enter the project details like your website URL, icon, choose the opt-in styles, and more.
1.5 Once the project details are added, click on the ‘Code integration’ button at the bottom of the page.
1.6 Now, you’ll see the code integration page. There are two codes you would need to install in order to send blogger push notifications:
- Service worker file
- SDK code
a) To download the service worker file, click on ‘Download sw.js’ as shown in the image below and Paste/Upload the file directly into the root of your Cpanel as explained in the video below.
If you have a PWA site, then follow this integration guide to set up your PWA push notifications.NOTE- To upload the sw.js file, you need access to the backend server of the website with either cPanel or FTP access.
How to ensure if my sw.js file is installed correctly?
You can check if you have installed the sw.js file correctly by going to your URL page and adding sw.js at the end of it.
For example, www.yourwebsite.com/sw.js.
A message similar to the below image will appear, confirming the correct installment of the service worker file.
STEP 2: Place SDK code
2.1 Login in to the admin panel of your Blogger website with the credentials. This will redirect you to the admin page of your website.
2.2 From the left menu, select “Theme“.
2.3 Now click on the “Edit HTML” button.
2.4 Paste the script that you get from the “Code Integration” tab on the Truepush dashboard inside the box and press “save”. If you like, you can give the title “Truepush” and press “save”.
Truepush is now integrated on your website.