You can integrate Truepush using Google Tag Manager by following the below steps.
STEP 1- Sign Up Into Truepush
STEP 2- Create A Tag In Google Tag Manager
STEP 3- Publish
1.1 Sign Up/Log In To Truepush
First, you have to either sign up/log in to Truepush by visiting the website
1.2 Download sw.js File
After logging into the truepush dashboard, go to the “code integration” within a project on the left side of the dashboard and download the sw.js file as shown below.
1.2.1 After downloading the sw.js file, upload it into your root file. To do that you should have access to the server in which the files are uploaded.
NOTE- To upload the sw.js file, you need access to the backend server of the website with either cPanel or FTP access.
You can use FileZilla Transfer, Cpanel, CCP.cloudaccess, etc. to access the server files.
1.3 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.
Create A Tag In Google Tag Manager
2.1 Log Into Google Tag Manager
2.1.1 Log into your google tag manager and goto workspace.
2.1.2 Add a “new tag“.
Tag– Tag in Google Tag Manager is a part of the code which sends the measurement information to the third party like google analytics.
2.1.3 Choose tag type as “CUSTOM HTML“.
2.2 Copy SDK code
2.2.1 Go to the Truepush dashboard and select “code integration“.
2.2.2 Copy the code as shown below and paste it inside the tag in the Google Tag Manager.
2.2.3 You can change the title of the tag and its recommended to save it as “sw.js” for your understanding.
2.3 Adding A Trigger
Trigger– Triggers in Google Tag Manager are defined as any action that fires a tag associated with it. Here, action could be any event such as page scroll, page load, clicks, form submission, etc.
2.3.1 Here, you can add a trigger to your tag for it to execute the tag into the website.
2.3.2 Save the tag.
2.3.3 After saving the tag, don’t forget to click on “submit“.
3.1 Choose the “publish and create a version” option and “live” at the bottom. Also, you can give version name and version descriptions as well.
3.2 Hit Publish and it is done.
This is how it should appear after publishing.
Your Google Tag Manager is now set up with Truepush, send a notification now!