- Joined
- Apr 17, 2018
- Messages
- 22,896
Alright, I need my JavaScript gurus to confirm this works...
I'm already running this and it seems to be working, but wanted to walk through it and see if you guys can see anything wrong.
First, the user clicks the button/cta on my LP. The offer (/click/1) opens in a new window and the original LP has the push prompt activated. If they click allow/deny/etc then they're taken to the trafficback link from ProPush.
My source doesn't seem to be tracking on ProPush for the trafficback but everything else seems to
JavaScript:
$(function() {
// trigger
$(".myubtton").on('click', function(e) {
// prevent default button click
e.preventDefault();
// propush
var url = new URL(window.location.href);
var pci = url.searchParams.get('clickid');
var ppi = url.searchParams.get('source');
var s = document.createElement('script');
s.src = '//oungimuk.net/pfe/current/micro.tag.min.js?z=3412424321fake' + '&ymid=' + pci + '&var=' + ppi + '&sw=/sw-check-permissions-29782.js';
s.onload = function(result) {
switch (result) {
case 'onPermissionDefault':
window.location.replace("//ungroudonchan.com/4/3412424321fake?var=" + ppi);
break;
case 'onPermissionAllowed':
window.location.replace("//ungroudonchan.com/4/3412424321fake?var=" + ppi);
break;
case 'onPermissionDenied':
window.location.replace("//ungroudonchan.com/4/3412424321fake?var=" + ppi);
break;
case 'onAlreadySubscribed':
window.location.replace("//ungroudonchan.com/4/3412424321fake?var=" + ppi);
break;
case 'onNotificationUnsupported':
break;
}
}
document.head.appendChild(s);
// open offer in new window
window.open("https://mytrackingdomain.com/click/1", "_blank", "noreferrer");
});
});
I'm already running this and it seems to be working, but wanted to walk through it and see if you guys can see anything wrong.
First, the user clicks the button/cta on my LP. The offer (/click/1) opens in a new window and the original LP has the push prompt activated. If they click allow/deny/etc then they're taken to the trafficback link from ProPush.
My source doesn't seem to be tracking on ProPush for the trafficback but everything else seems to
Last edited: