Good Afternoon I'm having issues with *`Multiple E...
# ask-questions
p
Good Afternoon I'm having issues with
Multiple 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 🙏
Untitled.txt
To give an idea of scale we're talking 10% of users: So this must be more than the odd anomaly
b
Hey Darren, in your original message you stated that
Experiment 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.
p
Michael thanks for your reply at setup I select
id
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 potentially
I have
id
in my targeting attributes too:
Whats particularly unusual is there was some instance of this "multiple" variants But then it has been huge since 18th october, Nothing has changed on the experiment or site to cause that.
If i run
Copy code
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 me
b
Hey Darren - I've pinged a few others on the team to take a look at this, looking at your
getUUID
function, it doesn't look like that is the issue. I'll follow up shortly.
p
Thanks @billions-xylophone-11752 🙏
@billions-xylophone-11752 hope you had a good weekend did anyone have ideas re: where double reporting could be occuring?