Cookie Consent Preferences Management in NetSuite

Manage cookie consent preferences efficiently in NetSuite, offering visitors control over their data tracking options.

·3 min read·View Oracle Docs

Persisting cookie preferences is crucial for compliance with data protection regulations and enhancing user experience in SuiteCommerce. This guide provides detailed steps to create a cookie consent banner, capture user preferences, and persist these preferences effectively in NetSuite.

How to Create a Cookie Banner View

Creating a view for the cookie consent banner involves setting up a form that allows users to accept or reject different types of cookies, such as marketing or performance cookies. Here’s how to get started:

  1. Define the View: Use the SCView class to define your cookie consent banner view.
  2. Include a Template: The template will display the form to users.
  3. Sample Code: Here is an example of how to structure your view:
javascript
1"text-purple-400">define (
2 'NetSuite.MyCookiesExtension.Banner.View',
3 [
4 'SCView',
5 'jQuery',
6 'netsuite_mycookiesextension_banner.tpl'
7 ],
8 "text-purple-400">function(SCViewComponent, jQuery, netsuite_mycookiesextension_banner_tpl) {
9 'use strict';
10
11 "text-purple-400">var SCView = SCViewComponent.SCView;
12
13 "text-purple-400">function MyCookiesExtensionBannerView(params) {
14 SCView.call("text-purple-400">this);
15 "text-purple-400">this.template = netsuite_mycookiesextension_banner_tpl;
16 "text-purple-400">this.userProfile = params.userProfile;
17 }
18
19 MyCookiesExtensionBannerView.prototype = Object.create(SCView.prototype);
20 MyCookiesExtensionBannerView.prototype.constructor = MyCookiesExtensionBannerView;
21
22 // Additional methods will follow
23 "text-purple-400">return MyCookiesExtensionBannerView;
24 }
25);

Initializing Cookie Banner Functionality

To effectively manage the cookie preferences, implement initialization tasks in the constructor:

  1. Check for existing cookies.
  2. Prompt the user with the consent form if no cookies are found.
  3. Update server cookies based on user interaction.

Here’s an example of how to manage cookie preferences:

javascript
1"text-purple-400">var browserConsentCookie = "text-purple-400">this.getBrowserConsentCookie() || null;
2"text-purple-400">if (browserConsentCookie) {
3 // Logic to handle existing preferences
4} "text-purple-400">else {
5 jQuery("text-purple-400">function() {
6 jQuery('#myCookiesExtensionBanner').show();
7 });
8}

How to Get and Set Browser Cookies

Manage browser cookies by implementing functions to get and set the trackingConsentCookie cookie:

Getting the Cookie

javascript
MyCookiesExtensionBannerView.prototype.getBrowserConsentCookie = "text-purple-400">function() {
// Implementation to retrieve the cookie
};

Setting the Cookie

javascript
MyCookiesExtensionBannerView.prototype.setBrowserConsentCookie = "text-purple-400">function(cookieOptions) {
// Logic to set the cookie
};

Capturing Visitor Preferences

When users save their preferences, gather their selections and format them correctly:

  • Essential cookies must always be accepted.
  • Select preferences for analytical cookies.

Here’s the savePrefs() function to capture user selections:

javascript
MyCookiesExtensionBannerView.prototype.savePrefs = "text-purple-400">function() {
// Implementation to save preferences
};

Persisting Preferences in NetSuite

To save cookie preferences in NetSuite, create a setCookiePreferences() function. Use the setCookieOptions() method to persist preferences if the user is logged in:

javascript
MyCookiesExtensionBannerView.prototype.setCookiePreferences = "text-purple-400">function(cookieOptions, browserCookieValue) {
// Code to save preferences in NetSuite
};

Conclusion

Persisting cookie preferences not only aids in compliance but enhances user trust and engagement. Implementing these steps will allow for better management of user consent, and ultimately foster a more transparent relationship with your visitors.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • Create a cookie consent banner to manage user preferences effectively.
  • Use the SCView class for defining the banner view.
  • Implement logic to handle existing cookie preferences dynamically.
  • Ensure compliance by persisting preferences in NetSuite correctly.

Frequently Asked Questions (4)

Do I need to enable a feature flag to use cookie consent preferences in SuiteCommerce?
The article does not mention the need for enabling a feature flag to use cookie consent preferences in SuiteCommerce.
How can I integrate the cookie consent banner in my SuiteCommerce site?
To integrate the cookie consent banner, use the 'SCView' class to define the view and include the necessary template that displays the consent form to users.
What should be done if no existing cookie preferences are found for a user?
If no existing cookie preferences are found, you should prompt the user with the consent form using methods like displaying the banner view through jQuery.
How should essential cookies be handled with user preferences?
Essential cookies must always be accepted, regardless of user preference for other types of cookies.
Source: Persist Cookie Preferences in NetSuite Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Commerce

View all Commerce articles →