-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: add google analytics, baidu and clarity (#1629)
Signed-off-by: Carson Yang <[email protected]>
- Loading branch information
1 parent
1db8161
commit ced23e1
Showing
5 changed files
with
68 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
baseURL = "/" | ||
baseURL = "fastgpt.in" | ||
languageCode = "en-GB" | ||
contentDir = "content" | ||
enableEmoji = true | ||
|
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,18 @@ | ||
<!-- baidutongji --> | ||
<script defer> | ||
function loadScriptOnScroll() { | ||
var scrollPosition = window.scrollY || window.pageYOffset; | ||
|
||
if (scrollPosition > 100) { | ||
var _hmt = _hmt || []; | ||
var hm = document.createElement("script"); | ||
hm.src = "https://hm.baidu.com/hm.js?537c7867df8f9ae2e7147284ec0dbfdd"; | ||
var s = document.getElementsByTagName("script")[0]; | ||
s.parentNode.insertBefore(hm, s); | ||
|
||
window.removeEventListener('scroll', loadScriptOnScroll); | ||
} | ||
} | ||
|
||
window.addEventListener('scroll', loadScriptOnScroll); | ||
</script> |
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 @@ | ||
<!-- Microsoft Clarity --> | ||
<script defer> | ||
function loadClarityScript() { | ||
(function(c,l,a,r,i,t,y){ | ||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; | ||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; | ||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); | ||
})(window, document, "clarity", "script", "mjgug8s1pf"); | ||
|
||
window.removeEventListener('scroll', onScrollLoadClarity); | ||
} | ||
|
||
function onScrollLoadClarity() { | ||
if (window.scrollY > 100) { | ||
loadClarityScript(); | ||
} | ||
} | ||
|
||
window.addEventListener('scroll', onScrollLoadClarity); | ||
</script> |
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,26 @@ | ||
<!-- Google tag (gtag.js) --> | ||
<script defer> | ||
function loadAnalyticsScript() { | ||
var script = document.createElement('script'); | ||
script.async = true; | ||
script.src = 'https://gaxy.fastgpt.in/gtag/js?id=G-KGYF44Y7TT'; | ||
document.head.appendChild(script); | ||
|
||
window.dataLayer = window.dataLayer || []; | ||
function gtag() { | ||
dataLayer.push(arguments); | ||
} | ||
gtag('js', new Date()); | ||
gtag('config', 'G-KGYF44Y7TT'); | ||
|
||
window.removeEventListener('scroll', onScrollLoadAnalytics); | ||
} | ||
|
||
function onScrollLoadAnalytics() { | ||
if (window.scrollY > 100) { | ||
loadAnalyticsScript(); | ||
} | ||
} | ||
|
||
window.addEventListener('scroll', onScrollLoadAnalytics); | ||
</script> |
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 |
---|---|---|
|
@@ -109,6 +109,9 @@ | |
{{- if not .Site.IsServer }} | ||
{{ with site.Params.umamiAnalytics.websiteid }} | ||
{{- partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "analytics/umami.html") . -}} | ||
{{- partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "analytics/google.html") . -}} | ||
{{- partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "analytics/baidu.html") . -}} | ||
{{- partialCached (printf "%s/%s" ($.Scratch.Get "pathName") "analytics/clarity.html") . -}} | ||
{{ end }} | ||
{{ end }} | ||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/[email protected]/style.css" as="style" /> | ||
|