Enabling Google AdWords Causes Error on Login

This topic applies to

Applies to

SuiteCommerce Advanced | Vinson


In some implementations of Vinson, Google Ads (previously called Google Adwords) can cause the following error:

"Uncaught TypeError: e.doCallback is not a function"

This error can occur when the following conditions are met:

  • Google Ads is enabled for a domain.

  • A customer adds items to their cart and logs out without completing the transaction.

  • The customer then attempts to log in again.

This error occurs in the Tracker module. To fix the error, you must extend the prototype object of the Tracker.prototype.trackEvent() function. For an example of the changes needed for this patch, see  EnablingGoogleAdWordsCausesErroronLogin.zip.


Before proceeding, familiarize yourself with Best Practices for Customizing SuiteCommerce Advanced.

Step 1: Extend the Tracker.js File

  1. If you have not done so already, create a directory to store your custom module.

    Give this directory a name similar to the module being customized. For example, create Modules/extensions/TrackerExtension@1.0.0

  2. In your new TrackerExtension @1.0.0 directory, create a subdirectory called JavaScript.

    For example: Modules/extensions/TrackerExtension@1.0.0/JavaScript

  3. In your new JavaScript subdirectory, create a JavaScript file to extend Tracker.js.

    Name this file according to best practices. For example:


  4. Open this file and extend the Tracker.prototype.trackEvent() method as shown in the following code snippet.

    //@module Tracker define('Tracker' , [ 'Singleton' , 'underscore' , 'Backbone' ] , function ( Singleton , _ , Backbone ) { 'use strict'; _.(extend Tracker.prototype, Tracker.prototype.trackEvent = function Tracker.prototype.trackEvent (event) { this.track('trackEvent', event); if (event.callback) { var doCallback = _.find(this.trackers, function (tracker) { return tracker.doCallback && tracker.doCallback(); }); !doCallback && event.callback(); } return this; }; } });
  5. Save the file.

Step 2: Prepare the Developer Tools For Your Customization

  1. Open your new TrackerExtension@1.0.0 module directory.

  2. Create a file in this directory and name it ns.package.json.


  3. Build the ns.package.json file using the following code:

    { "gulp": { "javascript": [ "JavaScript/*.js" ] } }
  4. Open the distro.json file. This is located in your root directory.

  5. Add your custom modules to the modules object.

    Your code should look similar to the following example:

    { "name": "SuiteCommerce Advanced Vinson Release", "version": "2.0", "buildToolsVersion": "1.2.1", "folders": { "modules": "Modules", "suitecommerceModules": "Modules/suitecommerce", "thirdPartyModules": "Modules/third_parties", "distribution": "LocalDistribution", "deploy": "DeployDistribution" }, "modules": { "extensions/TrackerExtension": "1.0.0", "suitecommerce/Account": "2.2.0", ...

    This ensures that the Gulp tasks include your module when you deploy.  In this example, the custom modules are added at the beginning of the list of modules. However, you can add the modules anywhere in the modules object. The order of precedence in this list does not matter.

  6. Add TrackerExtension as a dependency to SCA entry point within the SC.Shopping.Starter entrypoint of the JavaScript array.

    Your distro.js file should look similar to the following:

    "tasksConfig": {
    // ...
    "javascript": [
        // ... 
          "entryPoint": "SC.Shopping.Starter",
          "exportFile": "shopping.js",
          "dependencies": [
            // ...
            // ... 
  7. Save the distro.json file.

Step 3: Test and Deploy Your Customization

  1. Test your source code customizations on a local server (see SCA on a Local Server) or deploy them to your NetSuite account (see Deploy to NetSuite). If you are currently running SCA on a local server, your changes should appear on your local site immediately.

  2. Confirm your results.

    Upon successful deployment, enabling Google Ads does not cause errors when a customer logs in or out with items in the cart.

Related Topics