【问题标题】:Unique key for DoubleClick (DFP) data to Google Analytics Data in BigQuery?BigQuery 中 Google Analytics 数据的 DoubleClick (DFP) 数据的唯一键?
【发布时间】:2019-07-22 12:42:32
【问题描述】:

我为 BigQuery 设置了 DoubleClick(DFP/Google Ad Manager)数据和 Google Analytics 360 的每日导出。这些链接在我的 Google Analytics 帐户上,因此可以从分析 GUI 中查看广告管理器数据。

但是,当我查看会话数据时,似乎没有任何唯一键可以连接两个数据集。有没有办法在 bigquery 中加入这两个数据集?

【问题讨论】:

    标签: google-cloud-platform google-bigquery double-click double-click-advertising


    【解决方案1】:

    您不需要使用相同的列名来连接表

    with
    
    transactions as (
        select
            *
        from
            unnest(
                array[
                    struct(
                        'xxx' as pos_id,
                        1 as transaction_id,
                        date'2019-06-20' as transaction_date,
                        200 as amount),
    
                    struct('xxx', 2, date'2019-07-30', 1000),
                    struct('xxx', 3, date'2019-04-10', 500),
                    struct('xxx', 4, date'2019-05-15', 2000)
                ]
            )
    ),
    
    cashbacks as (
        select
            *
        from
            unnest(
                array[
                    struct(
                        'xxx' as pos_id,
                        date'2019-01-01' as start_date,
                        date'2019-04-30' as end_date,
                        0.1 as cashback),
    
                    struct('xxx', date'2019-07-01', date'2019-09-30', 0.2)
                ]
            )
    )
    
    
    select
        t.*,
        c.* except(pos_id)
    from
        transactions as t
        left join cashbacks as c
            on  t.pos_id = c.pos_id
                and t.transaction_date between  c.start_date
                                                and c.end_date
    order by
        1, 3 desc
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-12
      • 1970-01-01
      • 1970-01-01
      • 2022-10-24
      • 2018-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多