Adding a Third-Party Script for Analytics Tracking

This topic applies to

Applies to

SuiteCommerce Web Stores

You can integrate third party services with your SuiteCommerce Advanced web site. Note, however, that the SEO page generator does not evaluate third party scripts by default. You can specify ns-server-execute=’T’ to make sure that the script executes.

Scripts stored in the NetSuite file cabinet are evaluated automatically in the SEO page generator. Every JavaScript file referenced by a URL with a NetSuite domain, such as system.netsuite.com, or by your custom web site domain is executed automatically in the SEO page generator. To avoid duplicate execution of tracking scripts, such as GoogleAnalytics or visual-only JavaScripts, third party scripts are not automatically evaluated by the SEO page generator. This prevents execution of the script both in the browser that initiated the request and in the SEO page generator.

If you are calling a script from a different location (such as a third party web site), the script does not run automatically. Therefore, you need to specify ns-server-execute=’T’ to ensure that the script executes as expected. See the code sample below:

<script type='text/javascript' ns-server-execute='T' src='http://thirdparty.com/script.js'>

Important

The third-party scripts will be running in a Single Page Application (SPA) website, and not all third-party scripts are set up for SPAs. Consequently, the scripts might not work, or you might need to do a more complex integration than just add a script tag as described above.


Alternately, if you do not want to execute a script in the SEO page generator, and the script is stored in the file cabinet, to ensure that the SEO page generator does not evaluate your script, specify ns- server-execute=’F’.

If the <script> tag is dynamically injected into the DOM by a JavaScript code, the script will run in SEO page generator regardless of the domain and ns- server-execute=’F’ attribute. However, you can wrap the script in a statement similar to the following to indicate that it is not for the SEO page generator:

if(!SC.isPageGenerator()){
// Insert non-page generator content here }