Modelo de atribuição com a tabela de caminhos

As tabelas *_paths oferecem insights sobre as interações das pessoas com a mídia que você gerencia usando o Display & Video 360 e o Campaign Manager 360. Essas interações (ou pontos de contato) são agrupadas em caminhos de eventos e registram o caminho que um grupo de usuários faz pelo funil de conversão. Os dados nas tabelas *_paths usam as mesmas informações disponíveis na Transferência de dados, mas com transferência feita em caminhos pré-montados. Os caminhos de eventos estão disponíveis para usuários com e sem conversões e incluem várias conversões.

Assim como acontece com todos os dados do usuário no Ads Data Hub, as informações das tabelas *_paths estão sujeitas aos requisitos de agregação.

Detalhes técnicos

Cada linha de paths contém uma única jornada do cliente em um período de 30 dias. Essas informações são atualizadas em cada um dos últimos 30 dias. Os caminhos dos eventos são criados usando cookies e, portanto, ficam limitados a um único dispositivo. Em determinadas situações, por exemplo, quando os usuários desativam a personalização de anúncios, os IDs são definidos como 0. Esses usuários vão continuar separados por linha e, portanto, dois caminhos de conversão diferentes codificados em um ID do usuário igual a 0 ficarão em linhas diferentes. No entanto, para alguns tipos de análise, como agrupamento por user_id = 0, vários caminhos de conversão são mesclados em um só, o que pode criar discrepâncias nos dados. Conheça os IDs dos usuários zerados.

Cada linha da coluna *_paths.events contém uma matriz de structs, e cada struct é um único evento no caminho do usuário. As estruturas que compõem o caminho são organizadas pelo carimbo de data/hora, com o primeiro evento na matriz sendo o mais antigo.

Amostras de consultas

As consultas a seguir medem o impacto dos canais em relação a uma conversão de segmento de usuários específico. As consultas atribuem o crédito usando três modelos de atribuição diferentes:

  • Primeiro contato (o crédito vai para o primeiro ponto de contato)
  • Último contato (o crédito vai para o último ponto de contato)
  • Linear (o crédito é dividido igualmente entre os pontos de contato)

Dados de amostra

Linha user_id *_paths.events.event_time *_paths.events.event_type *_paths.events.placement_id
1 1 1563384139 FLOODLIGHT null
1563384129 CLICK 11
1563384119 VIEW 22
2 2 1563384139 FLOODLIGHT null
1563384129 VIEW 11
1563384119 FLOODLIGHT null
1563384109 VIEW 11

Amostras de consultas

Primeiro contato

/* Substitute *_paths for the specific paths table that you want to query. */
SELECT
  (
  SELECT
    attributed_event_metadata.placement_id
  FROM (
    SELECT
      AS STRUCT attributed_event.placement_id,
      ROW_NUMBER() OVER(ORDER BY attributed_event.event_time ASC) AS rank
    FROM
      UNNEST(t.*_paths.events) AS attributed_event
    WHERE
      attributed_event.event_type != "FLOODLIGHT"
      AND attributed_event.event_time < conversion_event.event_time
      AND attributed_event.event_time > (
      SELECT
        IFNULL( (
          SELECT
            MAX(prev_conversion_event.event_time) AS event_time
          FROM
            UNNEST(t.*_paths.events) AS prev_conversion_event
          WHERE
            prev_conversion_event.event_type = "FLOODLIGHT"
            AND prev_conversion_event.event_time < conversion_event.event_time),
          0)) ) AS attributed_event_metadata
  WHERE
    attributed_event_metadata.rank = 1) AS placement_id,
  COUNT(*) AS credit
FROM
  adh.*_paths AS t,
  UNNEST(*_paths.events) AS conversion_event
WHERE
  conversion_event.event_type = "FLOODLIGHT"
GROUP BY
  placement_id
HAVING
  placement_id IS NOT NULL
ORDER BY
  credit DESC

Último contato

/* Substitute *_paths for the specific paths table that you want to query. */
SELECT
  (
  SELECT
    attributed_event_metadata.placement_id
  FROM (
    SELECT
      AS STRUCT attributed_event.placement_id,
      ROW_NUMBER() OVER(ORDER BY attributed_event.event_time DESC) AS rank
    FROM
      UNNEST(t.*_paths.events) AS attributed_event
    WHERE
      attributed_event.event_type != "FLOODLIGHT"
      AND attributed_event.event_time < conversion_event.event_time
      AND attributed_event.event_time > (
      SELECT
        IFNULL( (
          SELECT
            MAX(prev_conversion_event.event_time) AS event_time
          FROM
            UNNEST(t.*_paths.events) AS prev_conversion_event
          WHERE
            prev_conversion_event.event_type = "FLOODLIGHT"
            AND prev_conversion_event.event_time < conversion_event.event_time),
          0)) ) AS attributed_event_metadata
  WHERE
    attributed_event_metadata.rank = 1) AS placement_id,
  COUNT(*) AS credit
FROM
  adh.*_paths AS t,
  UNNEST(*_paths.events) AS conversion_event
WHERE
  conversion_event.event_type = "FLOODLIGHT"
GROUP BY
  placement_id
HAVING
  placement_id IS NOT NULL
ORDER BY
  credit DESC

Linear

/* Substitute *_paths for the specific paths table that you want to query. */
SELECT
  attributed_event_metadata.placement_id AS placement_id,
  /* Give equal credit to all attributed events */
  SUM(SAFE_DIVIDE(1, ARRAY_LENGTH(attributed_events_metadata)))
FROM (
  SELECT
    ARRAY(
    SELECT
      AS STRUCT attributed_event.placement_id,
      ROW_NUMBER() OVER(ORDER BY attributed_event.event_time DESC) AS rank
    FROM
      UNNEST(t.*_paths.events) AS attributed_event
    WHERE
      attributed_event.event_type!="FLOODLIGHT"
      AND attributed_event.event_time < conversion_event.event_time
      AND attributed_event.event_time > (
      SELECT
        MAX(prev_conversion_event.event_time) AS event_time
      FROM
        UNNEST(t.*_paths.events) AS prev_conversion_event
      WHERE
        prev_conversion_event.event_type="FLOODLIGHT"
        AND prev_conversion_event.event_time < conversion_event.event_time)) AS attributed_events_metadata
  FROM
    adh.*_paths AS t,
    UNNEST(*_paths.events) AS conversion_event
  WHERE
    conversion_event.event_type="FLOODLIGHT" ),
  UNNEST(attributed_events_metadata) AS attributed_event_metadata
GROUP BY
  1
HAVING
  placement_id IS NOT NULL
ORDER BY
  2 DESC

Resultados

Se você executar a consulta nos dados de amostra, vai ter os seguintes resultados:

Primeiro contato

row placement_id credit
1 11 2
2 22 1

Último contato

row placement_id credit
1 11 3

Linear

row placement_id credit
1 11 2.5
2 22 0.5