Adding a Third-Party Script for Analytics Tracking

You can connect third-party services to your SuiteCommerce Advanced website. However, keep in mind that the SEO page generator doesn't evaluate third-party scripts by default. You can specify ns-server-execute=’T’ to make sure the script runs.

Scripts stored in the NetSuite file cabinet are evaluated automatically in the SEO page generator. Any JavaScript file referenced by a NetSuite domain URL, like system.netsuite.com, or by your custom website domain, runs automatically in the SEO page generator. To avoid running tracking scripts like Google Analytics or visual-only JavaScripts twice, the SEO page generator doesn't automatically evaluate third-party scripts. This keeps the script from running in both the browser that made the request and the SEO page generator.

If you're calling a script from a different location, like a third-party website, it doesn't run automatically. So, you need to specify ns-server-execute=’T’ to make sure the script runs as expected. See the following code sample:

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

        
Important:

The third-party scripts run 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 a more complex integration than adding a script tag like above.

If you don't want a script in the file cabinet to run in the SEO page generator, specify ns- serverexecute= ‘F’ to make sure it isn't evaluated.

If JavaScript dynamically injects a <script> tag into the DOM, the script will run in the SEO page generator no matter what the domain is or if you use ns- server-execute=’F’ attribute. But you can wrap the script in a statement like this to show it's not meant for the SEO page generator:

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

        

Related Topics

General Notices