-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(tracking): update refer links to other docs with utm_source (#4744)
- Loading branch information
Roshan Jossy
committed
May 5, 2022
1 parent
913d1f3
commit 36ce835
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters