From 75b77a868ed33b818828dfb642e7169af784b9ff Mon Sep 17 00:00:00 2001 From: scastineyras <162158563+scastineyras@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:18:32 -0300 Subject: [PATCH] bug fix - None != Undefined for segment Identify call (#89) * bug fix * cleanup fix --------- Co-authored-by: Sergio Castineyras --- .../opengov_custom_theme/templates/base.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ckanext/opendata_theme/opengov_custom_theme/templates/base.html b/ckanext/opendata_theme/opengov_custom_theme/templates/base.html index ae4f45b..8303b7b 100644 --- a/ckanext/opendata_theme/opengov_custom_theme/templates/base.html +++ b/ckanext/opendata_theme/opengov_custom_theme/templates/base.html @@ -12,8 +12,11 @@ analytics.group(entityid) {% if user %} if (window.location.pathname.endsWith("dashboard/")) { - var userplatformuuid = "{{ h.opendata_theme_platform_uuid() }}"; - analytics.identify(userplatformuuid || '{{user.id}}', {name: '{{user.fullname}}', email: '{{user.email}}'}); + var userId = "{{ h.opendata_theme_platform_uuid() }}"; + if (!userId || userId === 'None' || userId.length <= 30) { + userId = '{{user.id}}'; + } + analytics.identify(userId, {name: '{{user.fullname}}', email: '{{user.email}}'}); } {% endif %} }}();