Url aliasing:
- Needs to remove /staff/ from intranet pages
- remove _nocache
- remove all query strings
- remove /home
- needs to use code
741e0e81-8c7c-4934-a0b3-76f524f9a10a
for intranet and4a7ff1cf-f5b8-4dd8-95da-13bfe4f4e580
for homepage
Test cases:
Test | Should output | Pass/fail |
---|---|---|
https://intranet.wgtn.ac.nz/ | intranet.wgtn.ac.nz | |
https://intranet.wgtn.ac.nz/staff | intranet.wgtn.ac.nz | |
https://intranet.wgtn.ac.nz/staff?q=test | intranet.wgtn.ac.nz | |
https://intranet.wgtn.ac.nz/staff/home?q=test | intranet.wgtn.ac.nz | |
https://intranet.wgtn.ac.nz/staff/home/_nocache?q=test | intranet.wgtn.ac.nz | |
https://www.wgtn.ac.nz | www.wgtn.ac.nz | |
https://www.wgtn.ac.nz/staff | www.wgtn.ac.nz/staff | |
https://www.wgtn.ac.nz/students/campus/health/wellbeing/programmes-and-workshops/ | www.wgtn.ac.nz/students/campus/health/wellbeing/programmes-and-workshops/ | |
https://www.wgtn.ac.nz/students/campus/health/wellbeing/programmes-and-workshops/_nocache | www.wgtn.ac.nz/students/campus/health/wellbeing/programmes-and-workshops/ | |
https://www.wgtn.ac.nz/fhss | www.wgtn.ac.nz/fhss | |
https://www.wgtn.ac.nz/fhss/home | www.wgtn.ac.nz/fhss | |
https://www.wgtn.ac.nz/fhss/home/_nocache | www.wgtn.ac.nz/fhss | |
https://www.wgtn.ac.nz/fhss/home/_nocache?q=test | www.wgtn.ac.nz/fhss |
Mouseflow code:
<!--@@ Location of places mouseflow implemented: https://victoriauniversity.atlassian.net/wiki/spaces/BAU/pages/93458019/Mouseflow+tracking+update @@--> <!-- Mouseflow Current 1913605 --> <script type="text/javascript"> const mouseflowAssetId = "%asset_name% %asset_assetid%"; // Used for debugging on the front end var _mfq = _mfq || []; var currentHostname = window.location.hostname; var currentPathname = window.location.pathname; var mouseflowPath = window.location.hostname + window.location.pathname; // Set as default. Excludes all query strings // Edit path for mouseflowPath // Alias intranet.wgtn.ac.nz/staff to intranet.wgtn.ac.nz ONLY if intranet.wgtn.ac.nz is present if (currentHostname.indexOf("intranet") >= 0 && currentPathname.indexOf("/staff/") === 0) { console.log("Removing /staff from mouseflowPath"); currentPathname = currentPathname.substring("/staff".length); } // Remove _nocache if (currentPathname.indexOf("/_nocache") >= 0) { console.log("Remove _nocache from mouseflowPath"); currentPathname = currentPathname.substring(0, currentPathname.indexOf("/_nocache")); } // Remove /home if (currentPathname.search(/\/home$/) >= 0) { console.log("Remove /home from mouseflowPath"); currentPathname = currentPathname.substring(0, currentPathname.search(/\/home$/)); } // As extra precaution, remove trailing / if (currentPathname.charAt(currentPathname.length - 1) === "/") { console.log("Removing trailing / from mouseflowPath"); currentPathname = currentPathname.substring(0, -1); } mouseflowPath = currentHostname + currentPathname; console.log("mouseflowPath: " + mouseflowPath); (function () { var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true; // Check whether intranet or www if (currentHostname.indexOf("intranet") >= 0 // On intranet || currentPathname.indexOf("/staff/") === 0 // Catch for some situations where /staff/ is used instead of intranet. E.g. on cms.wgtn.ac.nz ) { console.log("Load intranet mouseflow"); mf.src = "//cdn.mouseflow.com/projects/741e0e81-8c7c-4934-a0b3-76f524f9a10a.js"; } else { console.log("Load regular mouseflow"); mf.src = "//cdn.mouseflow.com/projects/4a7ff1cf-f5b8-4dd8-95da-13bfe4f4e580.js"; } console.log(mf); // document.getElementsByTagName("head")[0].appendChild(mf); })(); </script>