GUA for Site Builder with Site Builder Extensions

This topic applies to

Applies to

SuiteCommerce Web Stores

If you are implementing GUA on Site Builder with Site Builder Extensions and an External (WSDK) site, see the following help topics:

Note

If you are implementing GUA on Site Builder without Site Builder Extensions, see the help topic Working with Google Analytics.


Step 1: Retrieve Tracking Code from an Existing GUA Account

If you already have a GUA account and website property, use the following procedure to retrieve your tracking ID and the GUA tracking code. If you do not have a GUA account and website property, see Set Up GUA Account and Website Property.

To retrieve GUA tracking code:

  1. Go to https://www.google.com/analytics.

  2. Click the Sign in link and choose Google Analytics.

  3. Click the Admin tab.

  4. If you have only one GUA account, it is automatically selected for you. If you have multiple GUA accounts, select the account that contains the website property.

  5. Select the website property for which you need the tracking code. If you have only one property, it is automatically selected for you.

  6. Under Property click Tracking Info.

  7. Click Tracking Code. This displays the following Tracking Code page:

  8. Copy the Tracking ID and paste it in a text editor document so you have it for later.

  9. Copy the Website tracking code and paste it in a text editor document so you have it for later.

Step 2: Update Tracking Code for Cross-Domain Tracking

The tracking code generated by GUA requires modification before you place it on the pages of your external site and in the Site Builder Addition to <head> field. Locate the following line of code:

ga('create', 'UA-xxxxxx-x', 'auto');

Change the code to this:

ga('create', 'UA-xxxxxx-x', 'auto', {'allowLinker': true});

Important

In this example make sure that UA-xxxxxx-x is the tracking ID for the website property.


Step 3: Add GUA Tracking Code to Site Builder

After you update the GUA tracking code for cross domain integration, the next step is to place the updated code in the Addition to <head> field on the Analytics subtab of the web site setup record.

To add GUA tracking code to site builder:

For this procedure you should have the GUA tracking code available, either in a text editor document or stored on your clipboard.

  1. Go to Setup > Site Builder > Set Up Web Site.

  2. Click the Edit link for the site.

  3. Select the Analytics sub tab.

  4. Paste the GUA tracking code into the Addition to <head> field.

  5. Select the Enable Google Analytics Integration box.

  6. Click the Save button.

Step 4: Enable GUA in Checkout

When using site builder with checkout in a Site Builder extension bundle or Site Builder with checkout in an extension bundle and an External (WSDK) site, you must also enable GUA in the checkout application by setting your GUA tracking ID and checkout domain in the checkout application. After it is implemented, GUA enables you to track all website activities from the homepage of your external site to your purchase confirmation page.

To enable GUA in Checkout

  1. Select the domain to configure at Setup > Site Builder > Configuration.

  2. In the SuiteCommerce Configuration record, navigate to the Integrations tab and the Google Universal Analytics Subtab.

  3. Set feature properties as required. For more information on each configurable property, see Google Universal Analytics Subtab.

  4. Save the Configuration record.

This topic applies to

Applies to

Denali | Mont Blanc

To enable GUA in Checkout (pre-Vinson)

The following procedure details the steps for creating a custom configuration module to enable Google Universal Analytics in checkout. This procedure adheres to NetSuite’s recommended best practice with regard to customizations. See Customize and Extend Core SuiteCommerce Advanced Modules for more information.

  1. In your source files create the following custom module directory structure:

    Modules/extensions/Configuration@1.0.0/JavaScript

  2. In the JavaScript folder create the javascript file to define your custom configuration options. In this example, the file is named ConfiguratorCheckout.js.

  3. Add the following javascript to the ConfiguratorCheckout.js file to set the GUA configuration options.

    define('ConfiguratorCheckout' , [ 'SC.Checkout.Configuration' ] , function ( Configuration ) { 'use strict'; return { mountToApp: function() { Configuration.tracking.googleUniversalAnalytics.propertyID = 'UA-12345678-9'; Configuration.tracking.googleUniversalAnalytics.domainName = 'my.webstore'; } } });

    Note

    Use your domain and GUA property ID. See Configuring GUA for information on obtaining your GUA property id.


  4. Create an ns.package.json file in the Configuration@1.0.0 directory.

    { "gulp": { "javascript": [ "JavaScript/*.js" ] } }
  5. Edit the distro.json file and add the custom module to the modules object. Your entry should be similar to the following:

    "modules": { "extensions/Configuration": "1.0.0", "suitecommerce/Account": "2.0.1", ...
  6. In the distro.json file, add your custom module to the list of taskConfig, javascript dependencies for the checkout.js file. To do this, locate the following section of code:

    "entryPoint": "SC.Checkout.Starter", "exportFile": "checkout.js", "dependencies": [ "Backbone.View.Plugins",
  7. Add your custom configuration file as the first dependency in the list:

    "entryPoint": "SC.Checkout.Starter", "exportFile": "checkout.js", "dependencies": [ "ConfiguratorCheckout", "Backbone.View.Plugins", ...
  8. Test your custom module on the local server and then deploy to the development SSP application in NetSuite. See Core SuiteCommerce Advanced Developer Tools for more information.

    Note

    You can use the Tag Assistant extension for Google Chrome to verify your GUA implementation on your site. In the following screenshot you see an entry for Google Universal Analytics on the site:


Step 5: GUA with Site Builder with Site Builder Extensions and an External Site (WSDK)

If you are using an External Site (WSDK) with your Site Builder with Site Builder Extensions site, you must place the same GUA tracking code on your external site that you placed in the Site Builder site setup record. Since the external site is a third party site, the method that you use for putting the tracking code on your site varies depending on how and where your third party site is hosted. The tracking code needs be placed on your site before the closing </head> tag.

Many content management systems have an addition to head option for this purpose. Ideally, addition to head is at the site level, so that tracking code is automatically placed on every page. In some instances, addition to head is at the page level, in which case you need to place it on all pages.

Related Topics