Remove subscriber from a particular segment

Posted in General by Tom Arthey Tue Jul 10 2018 11:15:28 GMT+0000 (Coordinated Universal Time)·6·Viewed 1,234 times

Can I use this to remove a subscriber from the global segment? It doesn't appear to be working.. If not, you should really update your documentation because I've spent a couple of days building under the impression that I could add a one click opt-out to our site.
July 10, 2018

Hi Tom,

This is Piyush from PushCrew Support team. Can you please let us know what is the API response you are getting as we can remove the user from the segment using the above mentioned API?


July 10, 2018

Hi Piyush,

Thanks for the swift reply! This is my unsub code at the moment:

window._pcq = window._pcq || [];
_pcq.push(['APIReady', onAPIReady]);

function onAPIReady() {
    var subscriberId = pushcrew.subscriberId;

    if(subscriberId !== false && subscriberId !== -1) {
        // ... show unsub button

        // ...
        _pcq.push(["removeSubscriberFromSegment", "global", onRemoveFromGlobal]);

function onRemoveFromGlobal(response) {
    if (response === 1) {
       // I can't seem to get here
    } else if (response === -1) {
       // This is where I end up if the user has blocked notifications
    } else {
       // This is where I end up if the user is allowing notifications

    // ...

The code used to show the notification pop-up to the user is here:

July 10, 2018

Just noticed I'm getting CORB issues in Chrome atleast:

Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/html. See for more details

July 10, 2018

Struggling to understand why this is a .gif URL and why it's trying to return text/html.. could this be a bug in your code?

July 10, 2018

Also having problems in Firefox, but less obvious errors.. hoping it's the same issue!

Markdown is allowed