mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 11:41:17 +02:00
fix: google analytics gtag forwarding issue
- update toc and code copy button styling - add unicode_range.py
This commit is contained in:
parent
dc57263f80
commit
fa16e82fe0
5 changed files with 63 additions and 12 deletions
|
@ -143,6 +143,8 @@ window
|
|||
</script>
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<!-- Define gtag on window object for proper Partytown forwarding -->
|
||||
<!-- See https://github.com/QwikDev/partytown/issues/382 -->
|
||||
{googleAnalyticsID && (
|
||||
<>
|
||||
<script
|
||||
|
@ -156,18 +158,18 @@ window
|
|||
define:vars={{ googleAnalyticsID, customGoogleAnalyticsJS }}
|
||||
>
|
||||
window.dataLayer = window.dataLayer || []
|
||||
function gtag(...args) {
|
||||
dataLayer.push(args)
|
||||
window.gtag = function () {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
dataLayer.push(arguments)
|
||||
}
|
||||
gtag('js', new Date())
|
||||
|
||||
window.gtag('js', new Date())
|
||||
if (customGoogleAnalyticsJS) {
|
||||
gtag('config', googleAnalyticsID, {
|
||||
window.gtag('config', googleAnalyticsID, {
|
||||
transport_url: new URL(customGoogleAnalyticsJS).origin,
|
||||
})
|
||||
}
|
||||
else {
|
||||
gtag('config', googleAnalyticsID)
|
||||
window.gtag('config', googleAnalyticsID)
|
||||
}
|
||||
</script>
|
||||
</>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue