Skip to content

Commit

Permalink
Merge pull request #207 from asumsi/dev
Browse files Browse the repository at this point in the history
add UTM tracking and fix sitemap base URL
  • Loading branch information
Yohan Totting authored Mar 24, 2023
2 parents 67c118a + 640b94c commit 4406403
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/_default/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseURL = '/'
baseURL = 'https://inlive.app/'
languageCode = 'en-us'
title = 'inLive'
theme = 'inlive'
Expand All @@ -15,4 +15,4 @@ maxAge = "10s"
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
unsafe = true
24 changes: 24 additions & 0 deletions themes/inlive/layouts/partials/head/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@
title: document.title || '-',
description: document.querySelector('meta[name="description"]')?.content || '-'
});

// register UTM if exists
if(window.URL){
const url = new URL(window.location.href)
const source=url.searchParams.get("utm_source")

if(source!==null){
const utm = {}
const medium=url.searchParams.get("utm_medium")
const campaign=url.searchParams.get("utm_campaign")
const content=url.searchParams.get("utm_content")
const term=url.searchParams.get("utm_term")

utm["utm_source"] = source

if(medium!==null) utm["utm_medium"] = medium
if(campaign!==null) utm["utm_campaign"] = campaign
if(content!==null) utm["utm_content"] = content
if(term!==null) utm["utm_term"] = term

mixpanel.register_once(utm);
}
}

</script>
{{ end }}

Expand Down

0 comments on commit 4406403

Please sign in to comment.