diff --git a/qdrant-landing/themes/qdrant-2024/assets/js/helpers.js b/qdrant-landing/themes/qdrant-2024/assets/js/helpers.js
index ce7830594..f01205a47 100644
--- a/qdrant-landing/themes/qdrant-2024/assets/js/helpers.js
+++ b/qdrant-landing/themes/qdrant-2024/assets/js/helpers.js
@@ -105,7 +105,7 @@ export function addGA4Properties(properties) {
properties.ga_client_id = getCookie('_ga')?.replace('GA1.1.','');
}
-export function addUTMToLinks() {
+export function getUTMParams() {
const urlParams = new URLSearchParams(window.location.search);
// Gather all GTM related params
@@ -122,6 +122,12 @@ export function addUTMToLinks() {
content: urlParams.get('utm_content')
};
+ return [utmIds, utmParams];
+}
+
+export function addUTMToLinks() {
+ const [utmIds, utmParams] = getUTMParams();
+
// Create new params string for outbound links and store in sessionStorage
let newParams = '';
for (const key in utmIds) {
diff --git a/qdrant-landing/themes/qdrant-2024/assets/js/segment-helpers.js b/qdrant-landing/themes/qdrant-2024/assets/js/segment-helpers.js
index 79762da90..be3cbbe06 100644
--- a/qdrant-landing/themes/qdrant-2024/assets/js/segment-helpers.js
+++ b/qdrant-landing/themes/qdrant-2024/assets/js/segment-helpers.js
@@ -1,4 +1,4 @@
-import { addGA4Properties, addUTMToLinks, getCookie, tagCloudUILinksWithAnonymousId } from './helpers';
+import { addGA4Properties, addUTMToLinks, getCookie, getUTMParams, tagCloudUILinksWithAnonymousId } from './helpers';
import { registerAndCall } from './onetrust-helpers';
const PAGES_SESSION_STORAGE_KEY = 'segmentPages';
@@ -96,7 +96,8 @@ const trackPageView = () => {
const category = 'Qdrant.tech';
const name = nameMapper(window.location.href);
- const properties = {};
+ const isFirstPageView = localStorage.getItem('isFirstPageView');
+ const properties = { isFirstPageView };
addGA4Properties(properties);
window.analytics.page(category, name, properties);
@@ -143,6 +144,19 @@ export function handleSegmentReady() {
addUTMToLinks();
analytics.ready(() => {
+ const [utmIds, utmParams] = getUTMParams();
+ const isFirstPageView = localStorage.getItem('isFirstPageView');
+
+ if (isFirstPageView === 'true') {
+ analytics.identify({
+ firstVisitAttribution: {
+ referrer: document.referrer,
+ ...utmParams,
+ ...utmIds
+ }
+ });
+ }
+
registerAndCall();
tagCloudUILinksWithAnonymousId();
tagAllAnchors();
diff --git a/qdrant-landing/themes/qdrant-2024/layouts/partials/js.html b/qdrant-landing/themes/qdrant-2024/layouts/partials/js.html
index 06982c480..f2fc3a137 100644
--- a/qdrant-landing/themes/qdrant-2024/layouts/partials/js.html
+++ b/qdrant-landing/themes/qdrant-2024/layouts/partials/js.html
@@ -11,6 +11,10 @@
+
{{ if hugo.IsProduction }}