Jan 25, 2022 7:35 AM
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
Solved! Go to Solution.
May 19, 2022 3:47 AM
@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 Consultant | Technical and Operational Specialist |
![]() | Did my post help answer your question? Help the community: mark this as a solution. |
May 19, 2022 3:47 AM
@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 Consultant | Technical and Operational Specialist |
![]() | Did my post help answer your question? Help the community: mark this as a solution. |
Jan 27, 2022 9:46 AM
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?