Merge pull request #32376 from overleaf/rh-cio-migrate-identifiers

Replace analytics id with user id as main identifier in customer.io

GitOrigin-RevId: 780671a51b652c73a940bc152d8fd6916dd611ce
This commit is contained in:
roo hutton
2026-04-02 08:05:48 +00:00
committed by Copybot
parent 972c6e4710
commit 9197be0ec7
4 changed files with 35 additions and 40 deletions
+5 -2
View File
@@ -1,7 +1,8 @@
if(customerIoEnabled && ExposedSettings.cioWriteKey && ExposedSettings.cioSiteId)
script(type="text/javascript", id="cio-loader", nonce=scriptNonce, data-cio-write-key=ExposedSettings.cioWriteKey, data-cio-site-id=ExposedSettings.cioSiteId, data-session-analytics-id=getSessionAnalyticsId()).
script(type="text/javascript", id="cio-loader", nonce=scriptNonce, data-cio-write-key=ExposedSettings.cioWriteKey, data-cio-site-id=ExposedSettings.cioSiteId, data-session-analytics-id=getSessionAnalyticsId(), data-user-id=((user && user._id) || '')).
var cioSettings = document.querySelector('#cio-loader').dataset;
var analyticsId = cioSettings.sessionAnalyticsId;
var userId = cioSettings.userId;
var siteId = cioSettings.cioSiteId;
var writeKey = cioSettings.cioWriteKey;
@@ -19,6 +20,8 @@ if(customerIoEnabled && ExposedSettings.cioWriteKey && ExposedSettings.cioSiteId
);
if (analyticsId) {
analytics.setAnonymousId(analyticsId);
analytics.identify(analyticsId);
}
if (userId) {
analytics.identify(userId);
};
}}();