- From: Nerdy Sherpas <notifications@github.com>
- Date: Mon, 26 Aug 2024 08:23:32 -0700
- To: w3c/push-api <push-api@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 26 August 2024 15:23:35 UTC
Sounds like you're looking for something that can do impression tracking. That's not specifically something to do with the W3 push-api. That said, to do so you'd want to just make a GET/POST to an external url when you are showing your push that handles that for you.
If you use something like simple like [ProxyHook](https://proxyhook.com) you'd do:
```
self.addEventListener('push', function(event) {
let trackingUrl = 'https://go.proxyhook.com/123';
//optionally grab the event data from the push to further narrow down (e.g. contents or campaign)
let payload = {};
//primary analytics
fetch(trackingUrl, {
method: 'post',
body: JSON.stringify(payload)
});
//show the push
self.registration.showNotification('Title', {});
})
```
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/386#issuecomment-2310477122
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/push-api/issues/386/2310477122@github.com>
Received on Monday, 26 August 2024 15:23:35 UTC