polite-afternoon-32745
10/26/2023, 1:02 PMMultiple Exposures Warning
This is on a website using the javascript SDK
My code is implemented via google tag manager
My data source is GA4 via bigquery
My code with redacted client key is in a thread against this message, but essentially I'm generating a users 'id' via a unique uuid generator which stores in a cookie.
Can anyone see an issue with my function getUUID()
in terms of consistently returning a stable unique identifier
Experiment assignment table is anonymous visitors
Does anyone have any knowledge of how a GA4 user could have multiple of those. does GA4 persist users across devices?
Appreciate any advise you can impart 🙏billions-xylophone-11752
10/26/2023, 1:12 PMExperiment assignment table is anonymous visitors
- By that do you mean the Assignment Attribute
for the experiment is anonymous_id
? Looking at your code, I don't see that you're passing in an anonymous_id
attribute.polite-afternoon-32745
10/26/2023, 1:15 PMid
which is the attribute which is passed in:
(see pic 1)
pic 2 details where i see "Anonymous Visitors" which must be explicit to GA4 potentiallyid
in my targeting attributes too:function getUUID() {
var COOKIE_NAME = "gbuuid";
var COOKIE_DAYS = 400;
var genUUID = function genUUID() {
var d = new Date().getTime();
var d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0;
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16;
if (d > 0) {
r = (d + r) % 16 | 0;
d = Math.floor(d / 16);
} else {
r = (d2 + r) % 16 | 0;
d2 = Math.floor(d2 / 16);
}
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
}
var getCookie = function getCookie(name) {
var value = "; ".concat(document.cookie);
var parts = value.split("; ".concat(name, "="));
if (parts.length === 2) return parts.pop().split(';').shift();
};
var setCookie = function setCookie(name, value) {
var d = new Date();
d.setTime(d.getTime() + 24 * 60 * 60 * 1000 * COOKIE_DAYS);
document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
};
if (getCookie(COOKIE_NAME)) return getCookie(COOKIE_NAME);
var uuid = genUUID();
setCookie(COOKIE_NAME, uuid);
return uuid;
};
getUUID();
several times in the same browser in console it always returns the same UUID for mebillions-xylophone-11752
10/26/2023, 2:15 PMgetUUID
function, it doesn't look like that is the issue. I'll follow up shortly.polite-afternoon-32745
10/26/2023, 2:39 PM