SiteSpect allows you to deploy JavaScript libraries globally across your website using a Global Change. This enables features like EventTrack or Client-Side Variations.
Steps to Deploy the Client-Side Libraries
- Create a new Global Change, and name it SiteSpect Libraries
- Make sure Scope is set to Site
- Under Apply template, click the SPA button
- Confirm that Triggers and Search & Replace areas are populated
- Preview and confirm that the libraries are populated loaded across all critical areas of the website
- Set Status to Active
- Save
Verifying That Libraries Are Loaded
-
Using the Browser Console:
- Open your website.
- Use the browser's developer tools to confirm the library is loaded. For example, check for
window.SS
in the console.
-
Check EventTrack or Client-Side Variations:
- Create a Client-Side Variation and confirm that it's working as expected.
- Fire an EventTrack from the browser console and confirm that the event is fired properly.
Cross-Domain Requests
If you plan on using a cross-domain request from another domain to capture Metrics on your SiteSpect-configured domains, you must use a fully qualified URL with the domain of a SiteSpect-tested site. Customize the domain name in the following code with the specific domain name that you have configured in SiteSpect.
Follow the steps above, and replace the value of the Replacement Text with the following:
<script>
window.SS = window.SS || {};
SS.Require = function (callback) {
if (typeof callback == "function") {
if (window.SS && SS.EventTrack) {
callback();
} else {
var siteSpect = document.getElementById("siteSpectLibraries");
var head = document.getElementsByTagName("head")[0];
if (siteSpect == null && head != undefined) {
siteSpect = document.createElement("script");
siteSpect.type = "text/javascript";
siteSpect.src = "https://www.website.com/__ssobj/core.js";
siteSpect.async = true;
siteSpect.id = "siteSpectLibraries";
head.appendChild(siteSpect);
}
if (window.addEventListener) {
siteSpect.addEventListener("load", callback, false);
} else {
siteSpect.attachEvent("onload", callback, false);
}
}
}
};
</script>
</head>
Update the Script Source to Match your Site's Configuration
- Replace the Domain:
- Update
https://www.website.com
to match your website domain that is configured in SiteSpect. - Example:
siteSpect.src = "https://www.mysite.com/__ssobj/core.js";
- Update
- Replace the Path:
- The default path is
/__ssobj/
. However, this path may be customized in your SiteSpect configuration. - Confirm your site-specific path with your SiteSpect Administrator or in your SiteSpect configuration.
- Replace
/__ssobj/
with the correct path, if customized. - Example for a customized path:
siteSpect.src = "https://www.mysite.com/ss-12345/core.js";
- The default path is
Notes:
- If using SS.EventTrack for tracking behaviors on pages that exist outside of a SiteSpect-tested site, a CORS (Cross-Origin Resource Sharing) header can be injected by SiteSpect. Please contact the Help Desk at helpdesk@sitespect.com and include the specified header to be added.
- Even if no other secure traffic for your site is served through SiteSpect, you must configure an SSL site in SiteSpect to use event tracking successfully on your secure pages. For assistance with configuring a secure site in SiteSpect, contact the Help Desk at helpdesk@sitespect.com.