Some custom scripts that you want to add to your career site will also set cookies or other tracking mechanisms in the visitor's browser. By following this guide you'll learn how to ensure that the script runs and cookies are set only when the visitor has accepted the relevant cookie category.
This guide contains of three steps;
Decide which category the cookie falls under
1. Decide which category the cookie falls under
There are three categories of cookies that a visitor needs to provide their consent to: Analytics, Marketing, and Preferences:
Analytics: These cookies collect information that is used to help you understand how the site is being used.
Marketing: These cookies are used to make advertising messages more relevant to the visitor, like selecting advertisements that are based on their interests. In some cases, they also perform a function on the site, such as social media integrations.
Preferences: These cookies allow the site to remember information that changes the way the site behaves or looks, such as visitors preferred language or the region they are in. Loss of information stored in a preference cookie may make the experience less functional but should not prevent it from working.
Once you have decided which category your cookie(s) falls under, move on to the next step.
2. Add the custom script
The actual script is provided by the service you want to add, it probably looks something like;
You need to make a small change to make it recognizable as a script that sets cookies. Add data-cookie-type="your-category" to the <script> tag.
The available types are analytics, marketing and preferences.
So, if this script to fall under marketing, the script that you add will end up looking something like this;
<script data-cookie-type="marketing" type="text/plain">
3. Add the cookie in settings
All done! The script will not run, and the cookie will not be set, until the visitor has accepted the relevant cookie cartegory 👍