This message was deleted.
# ask-questions
w
This message was deleted.
h
The figure is showing you only have 1 user in your treatment bucket.
Copy code
__rawExperiment as (
    SELECT
      user_id as user_id,
      TIMESTAMP_MICROS(event_timestamp) as timestamp,
      experiment_id_param.value.string_value AS experiment_id,
      variation_id_param.value.int_value AS variation_id,
      geo.country as country,
      traffic_source.source as source,
      traffic_source.medium as medium,
      device.category as device,
      device.web_info.browser as browser,
      device.operating_system as os
    FROM
      (
        SELECT
          *
        FROM
          `analytics_356435236.events_*`
        WHERE
          _TABLE_SUFFIX BETWEEN '20230330' AND '20230512'
        UNION ALL
        SELECT
          *
        FROM
          `analytics_356435236.events_intraday_*`
        WHERE
          _TABLE_SUFFIX BETWEEN '20230330' AND '20230512'
      ),
      UNNEST (event_params) AS experiment_id_param,
      UNNEST (event_params) AS variation_id_param
    WHERE
      event_name = 'experiment_viewed'
      AND experiment_id_param.key = 'experiment_id'
      AND variation_id_param.key = 'variation_id'
      AND user_id is not null
  )
    SELECT
      e.user_id as user_id,
      cast(e.variation_id as string) as variation,
      CAST(e.timestamp as DATETIME) as timestamp,
      CAST(e.timestamp as DATETIME) as conversion_start,
      DATETIME_ADD(CAST(e.timestamp as DATETIME), INTERVAL 72 HOUR) as conversion_end
    FROM
      __rawExperiment e
    WHERE
      e.experiment_id = 'new-secondary-panel-title'
      AND CAST(e.timestamp as DATETIME) >= DATETIME("2023-03-30 17:01:00")
That query should show you all the experiment impressions that fit this experiment. My guess is there will be very few results.
b
Thank you. I looked at the raw data again and it seems that user_id isn’t recorded for this experiment, and in the Network tab I see that when the user logs in, the exeriment_viewed event for the visual experiment, new-secondary-panel, is sent before the login event. Whereas for the (working) sdk experiment, aa-test-feature, it is sent after the login event. So that might be the root of the issue…
The experiment is set up to use logged-in users, but the GA event timing seems wrong and I’m not yet seeing how I can change it…
@helpful-application-7107 @fresh-football-47124 thank you so much for your patience and assistance. Yes, it seems that the issue was one of timing, with a visual experiment. I put in a setTimeout - the JavaScript programmer’s last-ditch workaround - to delay the experiment_viewed GA event and it is all now working!
Copy code
const growthbook = new GrowthBook({
  apiHost: '<http://localhost:4100>',
  clientKey: 'sdk-wwD7n4nfhRYZXeac',
  enableDevMode: true,
  trackingCallback: (experiment, result) => {
    console.log(
      '*** Experiment Viewed. experimentId:',
      experiment.key,
      'variationId:',
      result.key,
    );

    // make sure a visual experiment based on Logged-in Users
    // will send its experiment_viewed event after the Login event
    // so that user_id is tracked with experiment results
    setTimeout(() => {
      // track using GA4
      window.sendGA4event('experiment_viewed', {
        event_category: 'experiment',
        experiment_id: experiment.key,
        variation_id: result.key,
      });
    }, 10);
  },
});
Login is now sent before experiment_viewed for visual as well as SDK experiments:
139 Views