SuiteCommerce Analytics Data and Cookie Consent Integration

SuiteCommerce Analytics Data enables tracking of shopper behavior. This requires a cookie consent extension for user preferences.

·4 min read·View Oracle Docs

The SuiteCommerce Analytics Data feature allows you to track and measure user behavior and navigation on a SuiteCommerce website. To utilize this feature effectively, certain prerequisites must be met. Importantly, you need to enable the feature in your NetSuite account and install the SuiteCommerce cookie consent extension. This extension provides a mechanism for shoppers to manage their consent regarding the use of tracking and analytics cookies on your SuiteCommerce site. Additionally, if you seek a different user experience or additional functionality, custom extensions can be created using the available methods in the extensibility API.

Prerequisites

To successfully implement SuiteCommerce Analytics Data, ensure the following prerequisites are satisfied:

  • SuiteCommerce Analytics Data must be installed in your account to manage analytical data related to shopper navigation and behavior. For more information, refer to the SuiteCommerce Analytics Data Overview.

  • Application Performance Management for SuiteCommerce (SC APM) SuiteApp must also be installed. APM enables you to measure application performance and speed, while registering application actions in NetSuite. Details on this can be found in Application Performance Management (APM) for Commerce.

Creating Extension Files

You will create a baseline extension that establishes the necessary file structure for your extension:

1MyCookiesExtension
2 \Modules
3 \MainModule
4 \JavaScript
5 NetSuite.MyCookiesExtension.MainModule.js
6 NetSuite.MyCookiesExtension.Banner.View.js
7 NetSuite.MyCookiesExtension.Footer.View.js
8 \Templates
9 netsuite_mycookiesextension_banner.tpl
10 netsuite_mycookiesextension_footer.tpl

The following table details the purpose of each file:

FileDescription
NetSuite.MyCookiesExtension.MainModule.jsEntry point file for the extension, instantiating SuiteCommerce API components and loading views.
NetSuite.MyCookiesExtension.Banner.View.jsDisplays a form for website visitors to set cookie preferences above the website header.
NetSuite.MyCookiesExtension.Footer.View.jsShows a link for visitors to open the cookie banner in the footer of the website.
netsuite_mycookiesextension_banner.tplTemplate file for the banner view.
netsuite_mycookiesextension_footer.tplTemplate file for the footer view.

Updating the Entry Point File

In the entry point file, instantiate the Layout component to display the banner and footer views. The UserProfile component must also be instantiated and passed to the banner view:

javascript
1"text-purple-400">define(
2 'NetSuite.MyCookiesExtension.MainModule',
3 [
4 'NetSuite.MyCookiesExtension.Banner.View',
5 'NetSuite.MyCookiesExtension.Footer.View'
6 ],
7 "text-purple-400">function (MyCookiesExtensionBannerView, MyCookiesExtensionFooterView) {
8 'use strict';
9
10 "text-purple-400">return {
11 mountToApp: "text-purple-400">function mountToApp (container)
12 {
13 "text-purple-400">var layout = container.getComponent('Layout');
14 "text-purple-400">var userProfile = container.getComponent('UserProfile');
15
16 "text-purple-400">if (layout) {
17 layout.addChildView('Header', "text-purple-400">function() {
18 "text-purple-400">return "text-purple-400">new MyCookiesExtensionBannerView({userProfile: userProfile});
19 });
20
21 layout.addChildView('Footer', "text-purple-400">function() {
22 "text-purple-400">return "text-purple-400">new MyCookiesExtensionFooterView();
23 })
24 }
25 }
26 };
27});

To properly reference user preferences, the getBrowserConsentCookie() function is used to check for the existence of the consent cookie defined as 'trackingConsentCookie'. The cookie's value is a Base64-encoded string.

Persisting Cookie Preferences in NetSuite

To save the visitor's cookie consent preferences in NetSuite, create a function called setCookiePreferences() that takes in two parameters: the preferences object and the Base64-encoded string. Use the setCookieOptions() method from the UserProfile component to store the visitor preferences. This method requires a secure connection (HTTPS) and that the user is logged in.

javascript
1MyCookiesExtensionBannerView.prototype.setCookiePreferences = "text-purple-400">function(cookieOptions, browserCookieValue) {
2 "text-purple-400">this.userProfile.setCookieOptions(cookieOptions.consentSettings).then("text-purple-400">function(result) {
3 console.log('setCookieOptions was successful.');
4 })."text-purple-400">catch("text-purple-400">function() {
5 console.log('setCookieOptions failed.');
6 }).always("text-purple-400">function() {
7 document.cookie = "trackingConsentCookie=" + browserCookieValue;
8 });
9}

Implementing this feature will help you better understand and serve your customers while complying with legal requirements regarding cookie consent.

Key Components

  • User Consent Management: The extension allows users to manage their consent for data tracking to ensure compliance with regulations.
  • Modular Structure: The extension is structured in a modular fashion, allowing for easy updates and customizations.
  • Flexible Implementation: Developers can create custom extensions as needed using the extensibility API.

Conclusion

Incorporating the SuiteCommerce Analytics Data feature alongside the cookie consent extension is essential for eCommerce businesses looking to optimize their tracking and improve user trust. It ensures that users have control over their data collection and analysis while providing critical insights into customer behavior.


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

Key Takeaways

  • SuiteCommerce Analytics Data allows for the tracking of user behavior on eCommerce sites.
  • Installation of a cookie consent extension is crucial for managing user consent.
  • Developers can create custom extensions for enhanced functionality using the extensibility API.

Frequently Asked Questions (4)

What prerequisites must be met to implement SuiteCommerce Analytics Data?
To implement SuiteCommerce Analytics Data, ensure the SuiteCommerce Analytics Data feature and Application Performance Management for SuiteCommerce (SC APM) SuiteApp are installed in your account.
Is it necessary to develop custom extensions for the SuiteCommerce Analytics Data feature?
While custom extensions are not necessary, they can be created for additional user experiences and functionality using available methods in the extensibility API.
How do you persist cookie preferences in NetSuite?
To persist cookie preferences, use the setCookiePreferences() function along with the setCookieOptions() method from the UserProfile component, ensuring a secure connection and user login.
What does the SuiteCommerce cookie consent extension do?
The SuiteCommerce cookie consent extension allows website visitors to manage their consent for data tracking, ensuring compliance with regulations regarding cookie use.
Source: Prerequisites 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 →