Adding pushy.ai requires a code insertion plugin like Woody Snippets or Ad-inserter. As per pushy.ai instructions as shared below:
Place following script after <body> and before </body> on pages you want to prompt for notification permission.
<script type="text/javascript">
(function (document, window) {
/*
// handler to trigger prompt
const handler = function (ev) {
["keydown", "click", "contextmenu", "touchend"]
.forEach(ev => window.removeEventListener(ev, handler))
Pushy.prompt(window.userData)
}
// hook 'trusted' user initiated actions, call handler to prompt.
["keydown", "click", "contextmenu", "touchend"].forEach(ev => window.addEventListener(ev, handler))
*/
// registration script
let script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://sw.pushy.ai/wps/xxxxxxx-xxxx-xxxx-xxxx-xxxxxx/main/wpsmain.js';
script.onload = function () {
// userData
window.userData = {
attribution: {
source: 'Source',
campaign: 'Campaign',
adgroup: 'adgroup',
medium: 'medium'
},
pii: {
firstname: 'firstname',
lastname: 'lastname',
email: 'email',
md5email: 'md5email',
birthday: 'birthday',
sex: 'm/f',
city: 'Phoenix',
state: 'AZ',
zip: '89030'
}
}
Pushy.trackloadevent()
Pushy.prompt(window.userData)
/*
Availble registration events:
permissions-prompt
permissions-action-subscribed
permissions-action-subscribed-new
permissions-action-unsubscribed
permissions-prompt-action-deny
permissions-prompt-action-blocked
Pushy.on(['permissions-action-subscribed-new'], function () {
console.log("registered callback: new subscription")
});
Pushy.on(['permissions-prompt'], function () {
console.log("registered callback: displayed prompt")
});
Pushy.on(['permissions-action-subscribed'], function () {
console.log("registered callback: user already subscribed")
});
Pushy.on(['permissions-action-unsubscribed'], function () {
console.log("registered callback: user unsubscribed")
});
Pushy.on(['permissions-prompt-action-deny'], function () {
console.log("registered callback: prompt denied")
});
Pushy.on(['permissions-prompt-action-blocked'], function () {
console.log("registered callback: prompt blocked")
});
*/
}
document.getElementsByTagName("head")[0].appendChild(script);
})(document, window);
</script>
------------------------------------------------------------------------
Create file named wpsworker.js
Contents of file wpsworker.js:
importScripts("https://sw.pushy.ai/wps/xxxxxx-xxxx-xxxx-xxxx-xxxxxxx/sw/wpsworker.js");
Upload file to https://yourmoneygeek.com/wpsworker.js
------------------------------------------------------------------------
Lastly, Replace the contents of the previous service worker (https://yourmoneygeek.com/service-worker.js) with the contents of wpsworker.js.
Contents of file wpsworker.js:
importScripts("https://sw.pushy.ai/wps/xxxxxxx-xxxx-xxxxx-xxxx-xxxxxxx/sw/wpsworker.js");
Code language: HTML, XML (xml)
Do know that this code will be some different for every user, that URL part for sure.
So here are the steps required to add pushy.ai to WordPress:
First, copy the inline code, which has to be inserted between <body> and </body>, and you’ll have to insert it on the Footer using any code inserter plugin. Since I like Woody Snippets, so I am using that for this article.
Create a Universal Snippet on Woody Snippet, insert the code which starts with <script type="text/javascript"> and ends with </script>.
You’ll have to keep the snippet settings as shown below:

As per the above screenshot, the code has to be inserted automatically – Automatic insertion, the location would be Footer and show on Entire Website.
Publish the snippet; this part is over.
Now you need to insert two files i.e. wpsworker.js and service-worker.js to the root of the website. You can create the file locally on your PC first. Insert content in both files as shown on the second and third highlighted code from above.


To insert these files to the website’s root, you can use a File Manager plugin from the WordPress repository if you don’t know how to use FTP.
Clear all levels of the cache of the website. That’s all.