Manually Installing the Webtrends Tag

After downloading the Webtrends Tag Installer add-in, you should see 6 files for available for manual tagging within the root folder of the .zip file.

  1. webtrends.load.js
  2. webtrends.js
  3. webtrends.sp.js
  4. webtrends.sp.min.js (a minified version of the webtrends.sp.js)
  5. webtrends.ups.js (this file is optional)
  6. webtrends.ups.min.js (a minified version of the webtrends.ups.js)

Follow these steps to modify and deploy the Webtrends SharePoint tags manually:

  1. Create a new folder to store the Webtrends files, such as a Document Library or List on the site, and label it WebtrendsAssets for easy identification.
    • Take note of the URL to this folder.
    • It should appear similar to https://www.mydomain.com/sites/SiteCollection/WebtrendsAssets/.
  2. Open the webtrends.load.js file for editing in your preferred JavaScript editor.
  3. Update the window.wt_sp_globals.wtManualLoadConfigs function near the top of the file.
    • A copy visible below for your reference.
  4. Take note of the options highlighted in red in the MANUAL TAG CONFIG code snippet below.
    • These pertain to general configuration of the tag.
    • Update the window.wt_sp_globals.url property so that it points to the URL noted in step one.
    • Update the domain property with the appropriate SDC server domain, if using an On Premise SDC server.
    • Update the dcsid property with the appropriate dcsid for this set of tags.
    • Update the timezone with the appropriate numerical timezone for your environment.
      • Do not use text designations such as “PST” or “GMT”.
    • Update the homesite with the domain of your environment as needed.
      • This property is currently only used if window.wt_sp_globals.configs.plugins.sp.allClick tracking is set to true, and is used to denote if a generic link is considered onsite or offsite.
      • Using the default _spPageContextInfo.siteAbsoluteUrl value will cause any links leading off of the current site collection to be counted as offsite.
      • Using a domain will cause any links leading off the specified domain(s) to be counted as offsite.
      • This property now supports the use of a comma delimited list of values.
  5. Take note of the options highlighted in green in the MANUAL TAG CONFIG code snippet below.
    • These pertain to configuration of the User Profile Service plugin.
    • If you wish to use the minified file, update the src property file name to webtrends.ups.min.js.
    • If you do not wish to use the User Profile Service API call to gather extra user information:
      • Remove the code in green from the plugins: {} section.
      • Change window.wt_sp_globals.configs.plugins.sp.extraUserInfo to false.
  6. Take note of the options higlighted in blue in the code snippet below.
    • These pertain to configuration of the SharePoint plugin.
    • If you wish to use the minified file, update the src property file name to webtrends.sp.min.js.
    • See Configuring the Webtrends Analytics App for details on modifying these settings.
  7. Save your changes.
  8. Upload all Webtrends files into the WebtrendsAssets folder you created in step one.
  9. Check out your master page.
  10. Edit your master in your preferred editor.
    • Many sites use a separate master page for their Search Results page. Be sure to place this <script> line into all appropriate master pages.
    • SharePoint Designer has been known to not properly publish changes with SharePoint Online in the past.  You may need to download a copy, edit the file locally, and then upload the new copy to properly implement the tagging.
  11. In the <head> section of your master page, paste the following code, updating the src attribute value to the URL you created in step one, adding the webtrends.load.js file to the path:
<script type="text/javascript" src="https://www.mydomain.com/sites/SiteCollectionName/WebtrendsAssets/webtrends.load.js"></script>
  1. Save your changes and upload the master page.
  2. Publish your changes as needed.
/**********************MANUAL TAG CONFIG START*************************/

window.wt_sp_globals = window.wt_sp_globals ? window.wt_sp_globals : {};
window.wt_sp_globals.app = true;

window.wt_sp_globals.wtManualLoadConfigs = function () {
    window.wt_sp_globals.baseTagUrl = "//s.webtrends.com/js/";
    window.wt_sp_globals.url = window.wt_sp_globals.url ? window.wt_sp_globals.url : _spPageContextInfo.siteAbsoluteUrl + "/WebtrendsAssets/";
    window.wt_sp_globals.app = false;
    window.wt_sp_globals.configs = {
        domain: "statse.webtrendslive.com", // SDC Server
        dcsid: "xxxxxxxxxxxxxxxxxxxxxxxxx_xxxx", // DCSID
        timezone: "-8", // Time zone
        homesite: _spPageContextInfo.siteAbsoluteUrl,
        downloadtypes: "xls,doc,ppt,one,pub,jpg,bmp,gif,png,wmv,mpg,mp4,avi,csv,zip,txt,rtf,ics,js,dotx,gzip,mpp,msg,oft,pdf,potx,sql,vsd,vsdx,xap,xml,xps,xsn,docx,docm,dotm,docb,xlt,xlm,xlsx,xlsm,xlsb,pptx,pptm,ppsx,ppsm,onepkg",
        i18n: false,
        preserve: true,
        debug: false,
        plugins: {
            ups: {
                src: wt_sp_globals.url + "webtrends.ups.js",
                async: false,
                waitForCallback: true,
                timeout: 7500,
                userProfile: {
                    Department: "WT.shp_dept",
                    Manager: "WT.shp_mgr",
                    PreferredName: "WT.shp_uname",
                    Office: "WT.shp_office",
                    AccountName: "WT.shp_login",
                    Title: "WT.shp_title",
                    Location: "WT.shp_location",
                    Function: "WT.shp_function"
                }
            },
            sp: {
                src: wt_sp_globals.url + "webtrends.sp.js",
                async: false,
                waitForCallback: true,
                timeout: 7500,
                overlays: {}
            }
        }
    };

    if (typeof window.wt_sp_globals.configs.plugins.sp !== "undefined") {
        window.wt_sp_globals.configs.plugins.sp.extraUserInfo = true;
        window.wt_sp_globals.configs.plugins.sp.username = true;
        window.wt_sp_globals.configs.plugins.sp.userlogin = true;
        window.wt_sp_globals.configs.plugins.sp.dcsaut = true;
        window.wt_sp_globals.configs.plugins.sp.dcsautParam = "WT.shp_login";
        window.wt_sp_globals.configs.plugins.sp.dcsvid = false;
        window.wt_sp_globals.configs.plugins.sp.dcsvidParam = "WT.shp_login";
        window.wt_sp_globals.configs.plugins.sp.siteInfo = true;
        window.wt_sp_globals.configs.plugins.sp.toContent = true;
        window.wt_sp_globals.configs.plugins.sp.search = true;
        window.wt_sp_globals.configs.plugins.sp.bread = true;
        window.wt_sp_globals.configs.plugins.sp.webparts = true;
        window.wt_sp_globals.configs.plugins.sp.documentMenuClick = true;
        window.wt_sp_globals.configs.plugins.sp.list = true;
        window.wt_sp_globals.configs.plugins.sp.socialMenuClick = true;
        window.wt_sp_globals.configs.plugins.sp.allClick = true;
        window.wt_sp_globals.configs.plugins.sp.webPartLimit = "40";
        window.wt_sp_globals.configs.plugins.sp.multiTrack = false;
        /*
        DC-991 - Commented out
        window.wt_sp_globals.configs.plugins.sp.skipUPSInApps = true;
        */
        window.wt_sp_globals.configs.plugins.sp.ids = {};
        window.wt_sp_globals.configs.plugins.sp.ids.breadid = "DeltaPlaceHolderPageTitleInTitleArea";
        window.wt_sp_globals.configs.plugins.sp.ids.pritopleveluserid = "SuiteNavUserName"; // zz4_Menu for 2013
        window.wt_sp_globals.configs.plugins.sp.ids.sectopleveluserid = "zz5_Menu"; // zz5_Menu for 2013
        window.wt_sp_globals.configs.plugins.sp.ids.searchBox = "DataProvider";
        window.wt_sp_globals.configs.plugins.sp.ids.searchPage = "osssearchresults.aspx,results.aspx,search.aspx"; // list of search pages to check for (partial matches)
        window.wt_sp_globals.configs.plugins.sp.ids.searchResultBodyClassName = "ms-srch-item,ms-srch-bestBetItem,ms-srch-people-item,ms-srch-video-results ms-srch-video-results-container";
        window.wt_sp_globals.configs.plugins.sp.obfuscate = false;
        window.wt_sp_globals.configs.plugins.sp.obfuscateParams = "WT.shp_login,WT.shp_uname,DCS.dcsaut,WT.dcsvid,WT.shp_mgr";
        window.wt_sp_globals.configs.plugins.sp.stripIP = false;
        window.wt_sp_globals.configs.plugins.sp.legacyOnSite = false;
        window.wt_sp_globals.configs.plugins.sp.homedom = window.location.hostname;
        window.wt_sp_globals.configs.plugins.sp.homedomRegExp = false;
    }
};
/**********************MANUAL TAG CONFIG END*************************/

Your site should now be tagged. To verify functionality:

  1. Open a browser.
  2. Open the Developer Tools (F12)
  3. Verify that the webtrends.load.js file is present in the Debugger or Sources list of files.
    • If it is not visible, the URL from step 13 is probably invalid.
    • Update the file path with the proper URL to reach the webtrends.load.js file.
  4. Verify that the webtrends.js, webtrends.sp.js, and the webtrends.ups.js (if enabled) files are visible.
    • If they are not visible ensure that the window.wt_sp_globals.url path within the webtrends.load.js is pointing to the correct folder location.
    • Verify using the network tools section of the Developer Tools, or a 3rd party HTTP Proxy such as Fiddler, that requests for a dcs.gif are being sent to the SDC domain specified in the configuration above.