Skip to content

Commit

Permalink
docs(tracking): update external links' source (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshan Jossy authored May 9, 2022
1 parent 099e221 commit da87d13
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/_static/source-in-links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function addUTMSourceToLink(href) {
try {
var url = new URL(href);
url.searchParams.set("utm_source", "clip-as-service");
return url.href
}
catch{
return href
}
}

function addUTMSourceToLinks() {
var anchors = document.getElementsByTagName("a");

for (var i = 0; i < anchors.length; i++) {
anchors[i].href = addUTMSourceToLink(anchors[i].href)
}
}

window.onload = function () {
addUTMSourceToLinks()
}
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
]
html_js_files = [
'https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js',
'source-in-links.js',
]
htmlhelp_basename = slug
html_show_sourcelink = False
Expand Down

0 comments on commit da87d13

Please sign in to comment.