prehistoric-beard-84272
09/28/2023, 9:51 AManonymous_id
(based on device_id) as identifier, and have a dimension visitor_type
which can have the values "new", "returning", or "customer".
The dimension first has the value "new", but on a later visit it will be "returning", because the anonymous_id
was recognized.
So the user becomes part of the experiment with visitor_type
= "new", and returns and then sees the experiment, but now as visitor_type
= "returning"
How does GB deal with this when I segment the experiment result data by visitor_type
?helpful-application-7107
09/28/2023, 4:06 PMtimestamp
isn't a required field in the User Dimension definition, we have to use some arbitrary rule making to select one user dimension per user (right now we just use MAX
).
On your end, the best way to handle this would be to define your User Dimension using SQL Template variables where you define your user dimension yourself to get the latest record per user that has a timestamp < {{startDate}}
so that you can ensure all dimensions are pre-experiment (best for bias).WITH visitor_types AS (
SELECT
anonymous_id,
visitor_type,
ROW_NUMBER() OVER (PARTITION BY anonymous_id ORDER BY timestamp DESC) AS rn
FROM
dim_table
WHERE
timestamp > DATE_SUB({{startDate}}, INTERVAL 7 DAY) AND timestamp < {{startDate}}
)
SELECT
anonymous_id,
visitor_type
FROM visitor_types
WHERE rn = 1
prehistoric-beard-84272
09/29/2023, 6:11 AM