Skip to content

Commit

Permalink
docs(tracking): update refer links to other docs with utm_source (#4744)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshan Jossy committed May 5, 2022
1 parent 913d1f3 commit 36ce835
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions docs/_static/source-in-links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function addUTMSourceToLink(href) {
try {
var url = new URL(href);
url.searchParams.set("utm_source", "core");
return url.href
}
catch{}
}

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

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

window.onload = function () {
addSourceToAllLinks()
}
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css',
]
html_js_files = [
'https://cdn.jsdelivr.net/npm/qabot@0.4'
'https://cdn.jsdelivr.net/npm/qabot@0.4',
'source-in-links.js'
]
htmlhelp_basename = slug
html_show_sourcelink = False
Expand Down

0 comments on commit 36ce835

Please sign in to comment.