website: page events (#7721)

* website: page events

* rename

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
EvgenyandEvgeny @ SimpleX Chat authored and GitHub committed 2026-10-14 20:59:56 +01:00
1 parent 4c09af0619
commit 1b980de198
8 files changed
+41 -10

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
var pageEvents = {
domain: 'simplex.chat',
endpoint: 'https://api.simplex.chat/api/event',
logging: false,
outboundLinks: true,
transformRequest: function (event) {
if (window !== window.top || location.hostname.endsWith('.onion')) return null;
if (location.pathname.startsWith('/directory')) event.u = event.u.split('#')[0];
// remove hash from outbound links
if (event.p && event.p.url) event.p.url = event.p.url.split('#')[0];
return event;
}
};
+8
View File
@@ -212,6 +212,14 @@
<script>{% include "utm.js" %}</script>
{% if not noEvents %}
<script type="module">
import { init, track } from '/js/page.js';
{% include "events.js" %}
init(pageEvents);
</script>
{% endif %}
<script>
// switch theme
const sunIcon = document.querySelector('.sun');
+1
View File
@@ -3,6 +3,7 @@ layout: layouts/main.html
title: "SimpleX Chat - Contact"
header: "contact-hero-header"
templateEngineOverride: njk
noEvents: true
---
{% include "contact_page.html" %}
+2 -8
View File
@@ -1358,7 +1358,8 @@ templateEngineOverride: njk
</script>
<script type="module">
import { init, track } from '/js/page.js'
init({ domain: 'simplex.chat', endpoint: 'https://api.simplex.chat/api/event', logging: false })
{% include "events.js" %}
init(pageEvents)
var sections = Array.prototype.slice.call(document.querySelectorAll('section.page.cf[data-section]'))
var seen = {}
var current = 'hero'
@@ -1381,13 +1382,6 @@ templateEngineOverride: njk
})
var bar = document.querySelector('#cf-cta-invest')
if (bar) bar.addEventListener('click', function () { track('Invest', { props: { place: 'bar', section: current } }) })
var exits = [['#navbar .logo', 'home', 'logo'], ['.cf-fine-links a[href="/"]', 'home', 'footer'], ['.cf-fine-links a[href="/privacy"]', 'privacy', 'footer'],
['.cf-simplex-link', 'chat', 'request'], ['.cf-deck-link', 'deck', 'request'], ['.cf-modal-footnote a', 'source', 'ai-threat']]
exits.forEach(function (x) {
document.querySelectorAll(x[0]).forEach(function (el) {
el.addEventListener('click', function () { track('Exit', { props: { to: x[1], place: x[2] } }) })
})
})
document.addEventListener('mc:result', function (e) { track('Subscribed', { props: { status: e.detail.status } }) })
window.addEventListener('hashchange', function () {
var id = location.hash.slice(1)
+1
View File
@@ -4,6 +4,7 @@ title: "SimpleX File Transfer"
description: "Send files securely with end-to-end encryption"
templateEngineOverride: njk
active_file: true
noEvents: true
---
{% set lang = page.url | getlang %}
{% from "components/macro.njk" import overlay %}
+1
View File
@@ -3,6 +3,7 @@ layout: layouts/main.html
title: "SimpleX Chat - Invitation"
header: "invitation-hero-header"
templateEngineOverride: njk
noEvents: true
---
{% include "contact_page.html" %}
+1
View File
@@ -2,6 +2,7 @@
layout: layouts/token.html
title: "SimpleX Community Credits"
permalink: "/credits/index.html"
noEvents: true
---
# SimpleX Crowdfunding to Build Community Credits: Strategy & Vision
+14 -2
View File
@@ -1,12 +1,24 @@
---
templateEngineOverride: njk
eleventyExcludeFromCollections: true
destinationURI: "https://wefunder.com/simplex.chat"
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script>location.replace('https://wefunder.com/simplex.chat' + location.search);</script>
<script type="module">
{% include "node_modules/@plausible-analytics/tracker/plausible.js" %}
{% include "events.js" %}
try {
pageEvents.autoCapturePageviews = false;
init(pageEvents);
track('pageview');
} finally {
location.replace('{{ destinationURI }}' + location.search);
}
</script>
<script nomodule>location.replace('{{ destinationURI }}' + location.search);</script>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Invest in SimpleX Chat</title>
@@ -18,7 +30,7 @@ eleventyExcludeFromCollections: true
<meta property="og:image" content="{% cfg 'siteLocation' %}/img/share_simplex.jpg"/>
<meta name="twitter:card" content="summary"/>
<link rel="icon" type="image/png" sizes="96x96" href="/img/favicon.ico"/>
<noscript><meta http-equiv="refresh" content="0; url=https://wefunder.com/simplex.chat" /></noscript>
<noscript><meta http-equiv="refresh" content="0; url={{ destinationURI }}" /></noscript>
</head>
<body></body>
</html>