There are two steps to integrate Truepush with WordPress 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. 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 Download the sw.js file from the ‘Code Integration” page on the Truepush dashboard as shown below.

Code Integration


1.3 Paste/Upload the file directly into the root of your WordPress installation.

1.3.1 To place the sw.js file into your WordPress site you can download the file manager plug-in and place it in the root folder.

File Manager


1.3.2 Activate the Plugin and go to the file manager.

WP File Manager


1.3.3 In the public_html folder upload the sw.js file.

SW.JS


Upload File


1.4  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.

SW.JS


STEP 2: Place SDK code

2.1 Login to the admin panel of your WordPress website. This will redirect you to the admin page of your website.

SDK Code


2.2 From the left menu, under the “Appearance” tab, select the ” Theme Editor” submenu option.

2.3 Now Select “footer.php” from the right-hand side menu named as “Theme Files“.

Theme Files


2.4 In the code integration page, copy the SDK code as shown below and place it just before the closing body tag of your HTML.

Code Integration

Truepush is now integrated into your website.