Skip to content

Commit 47e0a7c

Browse files
Roshan Jossyalaeddine-13
andauthored
update refer links to other docs with utm_source (docarray#317)
* docs(tracking): update refer links to other docs with utm_source * docs(tracking): update refer links to other docs with utm_source * Revert "docs(tracking): update refer links to other docs with utm_source" This reverts commit 0bed921. * fix: fix utm js script Co-authored-by: Alaeddine Abdessalem <[email protected]>
1 parent c9a9b35 commit 47e0a7c

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

docs/_static/source-in-links.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function addUTMSourceToLink(href) {
2+
try {
3+
var url = new URL(href);
4+
url.searchParams.set("utm_source", "docarray");
5+
return url.href
6+
}
7+
catch{
8+
return href
9+
}
10+
}
11+
12+
function addUTMSourceToLinks() {
13+
var anchors = document.getElementsByTagName("a");
14+
15+
for (var i = 0; i < anchors.length; i++) {
16+
anchors[i].href = addUTMSourceToLink(anchors[i].href)
17+
}
18+
}
19+
20+
window.onload = function () {
21+
addUTMSourceToLinks()
22+
}

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
]
7979
html_js_files = [
8080
'https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js',
81-
'https://cdn.jsdelivr.net/npm/[email protected]'
81+
'https://cdn.jsdelivr.net/npm/[email protected]',
82+
'source-in-links.js'
8283
]
8384
htmlhelp_basename = slug
8485
html_show_sourcelink = False

0 commit comments

Comments
 (0)