Skip to content

Commit

Permalink
Add first-party tracking system to blog
Browse files Browse the repository at this point in the history
  • Loading branch information
nkalupahana committed Feb 7, 2024
1 parent 06cca1d commit 48b8b54
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ gem "jekyll-feed", "~> 0.9"
gem "jekyll-seo-tag", "~> 2.1", git: "https://github.com/nkalupahana/jekyll-seo-tag"
gem "kramdown-parser-gfm" if ENV["JEKYLL_VERSION"] == "~> 3.9"
gem "jekyll-toc"
gem "jekyll-sitemap"
gem "jekyll-sitemap"
gem "csv"
gem "base64"
gem "bigdecimal"
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ GEM
specs:
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bigdecimal (3.1.5)
colorator (1.1.0)
concurrent-ruby (1.2.3)
csv (3.2.8)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
Expand Down Expand Up @@ -86,6 +89,9 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
base64
bigdecimal
csv
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)!
Expand Down
7 changes: 7 additions & 0 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ <h2>Ready to get started?</h2>
utm_campaign = params.get("utm_campaign");
}

const lssource = localStorage.getItem("utm_source");
const lscampaign = localStorage.getItem("utm_campaign");
if (lssource && lscampaign) {
utm_source = lssource;
utm_campaign = lscampaign;
}

for (const el of document.getElementsByClassName("appStoreLink")) {
el.onclick = () => {
sendInstallRequest();
Expand Down
6 changes: 6 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,10 @@ <h3 class="sidebar-heading">Better mental health, within your reach</h3>
document.addEventListener("DOMContentLoaded", function(e) {
Scroller.init();
})
const source = localStorage.getItem("utm_source");
const campaign = localStorage.getItem("utm_campaign");
if (!source && !campaign) {
localStorage.setItem("utm_source", "blog");
localStorage.setItem("utm_campaign", '{{ page.title | downcase | split: " " | join: "_"}}');
}
</script>

0 comments on commit 48b8b54

Please sign in to comment.