Skip to content

Commit

Permalink
Update general amplitude config, modify tracking code so that the eve…
Browse files Browse the repository at this point in the history
…nt gets registered (#187)
  • Loading branch information
ail3ngrimaldi authored Oct 4, 2024
1 parent aba44ab commit 37bf5a8
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 287 deletions.
29 changes: 23 additions & 6 deletions _layouts/landing.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,30 @@
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
<!-- Amplitude -->
<script src="https://cdn.amplitude.com/libs/analytics-browser-2.7.1-min.js.gz"></script><script src="https://cdn.amplitude.com/libs/plugin-session-replay-browser-1.2.0-min.js.gz"></script>
<script src="https://cdn.amplitude.com/libs/analytics-browser-2.7.1-min.js.gz"></script>
<script src="https://cdn.amplitude.com/libs/plugin-session-replay-browser-1.2.0-min.js.gz"></script>
<script src="https://cdn.amplitude.com/libs/plugin-autocapture-browser-0.9.0-min.js.gz"></script>
<script>window.amplitude.init('88119dfbd18136240ad8303dc877b6a8');window.amplitude.add(window.sessionReplay.plugin({sampleRate: 1}));window.amplitude.add(window.amplitudeAutocapturePlugin.plugin());</script>
<!-- Simple Analytics -->
<script async defer src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
<noscript><img src="https://queue.simpleanalyticscdn.com/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade"/></noscript>
<meta name="sa-verify" content="fvirtonetwowv0n" />
<script>
window.amplitude.init('88119dfbd18136240ad8303dc877b6a8', null, {
attribution: {
excludeReferrers: ['/']
},
transport: "beacon",
saveEvents: true,
saveParamsReferrerOncePerSession: false,
trackingOptions: {
ipAddress: false,
language: true,
platform: true
},
logLevel: "WARN"
});
window.amplitude.add(window.sessionReplay.plugin({
sampleRate: 1,
}));
window.amplitude.add(window.amplitudeAutocapturePlugin.plugin());
</script>


</head>

Expand Down
73 changes: 37 additions & 36 deletions landings/a/index.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -119,47 +119,48 @@ ul li, .auto-grid li { display: flex; align-items: center; gap: 1.75em; }
{% endfor %}

<script>
document.addEventListener('DOMContentLoaded', function() {
window.amplitude.track('view:landing:a');
document.addEventListener('DOMContentLoaded', function() {
window.amplitude.track('view:landing:a');
function handleCtaClick(event) {
let superior = document.querySelector('.track-superior-cta');
superior.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://waitlist.virto.network/');
redirectUrl.searchParams.set('b', 'b-one');
if (event.currentTarget.classList.contains('track-superior-cta')) {
window.amplitude.track('landing:a:click-superior-cta');
} else if (event.currentTarget.classList.contains('track-inferior-cta')) {
window.amplitude.track('landing:a:click-inferior-cta');
}
window.open(redirectUrl.toString(), '_blank');
}
let ctas = document.querySelectorAll('.button');
ctas.forEach((cta) => {
cta.addEventListener('click', handleCtaClick);
});
redirectUrl.searchParams.set('b', 'b-one');
window.amplitude.track('landing:a:superior');
window.open(redirectUrl.toString(), '_blank');
})
let inferior = document.querySelector('.track-inferior-cta');
inferior.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://waitlist.virto.network/');
redirectUrl.searchParams.set('b', 'b-one');
amplitude.track('landing:a:click-inferior-cta');
window.open(redirectUrl.toString(), '_blank');
})
let telegram = document.getElementById("telegram");
telegram.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://t.me/+573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:a:click-telegram');
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
let whatsapp = document.getElementById("whatsapp");
whatsapp.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://api.whatsapp.com/send?phone=573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:a:click-whatsapp');
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
telegram.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://t.me/+573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:a:click-telegram')
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
let whatsapp = document.getElementById("whatsapp");
whatsapp.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://api.whatsapp.com/send?phone=573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:a:click-whatsapp')
setTimeout(() => {
newWindow.location = redirectUrl.toString();
}, 200)
});
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
Expand Down
42 changes: 22 additions & 20 deletions landings/b/index.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -121,42 +121,44 @@ ul li, .auto-grid li { display: flex; align-items: center; gap: 1.75em; }
{% endfor %}

<script>
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function() {
window.amplitude.track('view:landing:b');
function handleCtaClick(event) {
event.preventDefault();
let redirectUrl = new URL('https://waitlist.virto.network/');
redirectUrl.searchParams.set('b', 'b-two');
if (event.currentTarget.classList.contains('track-superior-cta')) {
window.amplitude.track('landing:b:click-superior-cta');
} else if (event.currentTarget.classList.contains('track-inferior-cta')) {
window.amplitude.track('landing:b:click-inferior-cta');
}
window.open(redirectUrl.toString(), '_blank');
}
let ctas = document.querySelectorAll('.button');
ctas.forEach((cta) => {
cta.addEventListener('click', handleCtaClick);
});
let superior = document.querySelector('.track-superior-cta');
superior.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://waitlist.virto.network/');
redirectUrl.searchParams.set('b', 'b-two');
window.amplitude.track('landing:b:superior');
window.open(redirectUrl.toString(), '_blank');
});
let inferior = document.querySelector('.track-inferior-cta');
inferior.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://waitlist.virto.network/');
redirectUrl.searchParams.set('b', 'b-two');
window.amplitude.track('landing:b:click-inferior-cta');
window.open(redirectUrl.toString(), '_blank');
});
let telegram = document.getElementById("telegram");
telegram.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://t.me/+573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:b:click-telegram');
window.amplitude.track('landing:b:click-telegram');
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
let whatsapp = document.getElementById("whatsapp");
whatsapp.addEventListener('click', (event) => {
event.preventDefault();
event.preventDefault();
let redirectUrl = new URL('https://api.whatsapp.com/send?phone=573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:b:click-whatsapp');
window.amplitude.track('landing:b:click-whatsapp');
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
Expand Down
45 changes: 23 additions & 22 deletions landings/c/index.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -142,32 +142,33 @@ document.addEventListener('DOMContentLoaded', function() {
}
window.open(redirectUrl.toString(), '_blank');
}
let ctas = document.querySelectorAll('.button');
let ctas = document.querySelectorAll('.track-superior-cta, .track-inferior-cta');
ctas.forEach((cta) => {
cta.addEventListener('click', handleCtaClick);
});
let telegram = document.getElementById("telegram");
telegram.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://t.me/+573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:c:click-telegram')
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
telegram.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://t.me/+573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:c:click-telegram');
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
let whatsapp = document.getElementById("whatsapp");
whatsapp.addEventListener('click', (event) => {
event.preventDefault();
let redirectUrl = new URL('https://api.whatsapp.com/send?phone=573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:c:click-whatsapp');
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
let whatsapp = document.getElementById("whatsapp");
whatsapp.addEventListener('click', function() {
let redirectUrl = new URL('https://api.whatsapp.com/send?phone=573107887042');
const newWindow = window.open(redirectUrl, '_blank');
amplitude.track('landing:c:click-whatsapp')
setTimeout(function() {
newWindow.location = redirectUrl.toString();
}, 200);
});
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
Expand Down
Loading

0 comments on commit 37bf5a8

Please sign in to comment.