APIs & Integrations

James-Pi-Top
Membre

What is the javascript property to use to unsubscribe from all emails using _hsq.push

Résolue

Hi

We have a website that is used both in schools and by members of the public.

 

Currently we are unintentionally signing up school pupils to marketing emails, so in order to prevent this we want to unsubscribe student accounts from marketing emails.

this is the code we have so far

 

  _hsq.push([
    'identify',
    {
      email,
      id,
      unsubscribeFromAll: isStudent ? 'true' : 'false',
    },
  ]);

  _hsq.push(['trackEvent', { id: 'login', email }])

 

but this does not work.


Can you let me know what the correct way to do this is?

Many Thanks

James Smith
pi-top.com

 

 

0 Votes
1 Solution acceptée
mangelet
Solution
Guide | Partenaire solutions Platinum
Guide | Partenaire solutions Platinum

What is the javascript property to use to unsubscribe from all emails using _hsq.push

Résolue

@James-Pi-Top have you considered using a workflow on a custom property named 'isStudent' ?

 

Also, make sure you can update contact properties using the tracking code AP: https://knowledge.hubspot.com/account/prevent-contact-properties-update-through-tracking-code-api.

Martin Angeletti
HubSpot Veteran (12+ years)

Worried about messing up your HubSpot? I've got your back.

Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).

️ Don't get left behind.

→ Click the subscribe button and scroll down to find the opt-in box.

Subscribe

Did I help answer your question? Mark this as a solution.

Voir la solution dans l'envoi d'origine

0 Votes
2 Réponses
mangelet
Solution
Guide | Partenaire solutions Platinum
Guide | Partenaire solutions Platinum

What is the javascript property to use to unsubscribe from all emails using _hsq.push

Résolue

@James-Pi-Top have you considered using a workflow on a custom property named 'isStudent' ?

 

Also, make sure you can update contact properties using the tracking code AP: https://knowledge.hubspot.com/account/prevent-contact-properties-update-through-tracking-code-api.

Martin Angeletti
HubSpot Veteran (12+ years)

Worried about messing up your HubSpot? I've got your back.

Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).

️ Don't get left behind.

→ Click the subscribe button and scroll down to find the opt-in box.

Subscribe

Did I help answer your question? Mark this as a solution.

0 Votes
dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

What is the javascript property to use to unsubscribe from all emails using _hsq.push

Résolue

@James-Pi-Top 

How is everyone being signed up for these marketing emails currently?

There is an endpoint for subscription preferences here

Might also be able to enroll students in a workflow to remove from subscriptions?

0 Votes