2024 年 2 月 23 日,事件开始出现问题。
我的问题是,purchase和login事件没有出现在** GA4**中,即使代码在 GTM 中针对这些事件触发。
我已经确定了它不触发的原因。当我发送没有 param user_id 的请求时,购买事件将进入 GA4。但是,一旦我在请求中包含参数 user_id,事件就会停止通过。
我正在通过测量协议传输事件。有趣的是,还有另一个事件 add_to_cart 也是通过 MP 发送的,最初参数中没有 user_id,并且没有遇到任何问题,成功到达 GA4。
问题出现期间没有对 GTM 或 POST 请求进行任何更改。换句话说,如果我没有做任何改变,事件就停止了。
我的怀疑是针对 Google Consent Mode V2,但我尚未找到对此的确认。
POST 请求(一直有效到 2024 年 2 月 22 日,现在正在工作)
{
"client_id": "FPID2.2.deleted in example",
"events": [{
"name": "purchase",
"params": {
"v": 2,
"en": "purchase",
"tid": "deleted in example",
"client_id": null,
"client_id_2": null,
"currency": "USD",
"d_time": "08:08:38.000Z",
"date": "2024-03-22",
"email": null,
"engagement_time_msec": null,
"environment": "production",
"event_n": "purchase",
"event_name": "purchase",
"f_engagement_time_msec": 0,
"f_session_id": 1710129998,
"f_session_number": 1,
"ga_session_id": null,
"gclid": null,
"items": [
{
"item_brand": "deleted in example",
"item_category": "Subscribe",
"item_category2": "First transaction",
"item_id": "Single Use once",
"item_name": "Single Use once",
"price": 29,
"quantity": 1
}
],
"page_location": "https://deleted in example",
"page_title": "deleted in example",
"session_id": null,
"timestamp": 1710129998309,
"timestamp_micros": 1710140797957000,
"traffic_source": null,
"transaction_id": "93213cfdg1",
"user_id": "0020b27c-160a-450b-8806-b4287b88162a",
"value": 29
}
}
]
}
我研究了调试模式,我看到了带有 user_id 和不带 user_id 的事件。有趣的是,如果我在 GA4 调试模式下发送时不带 user_id 参数,我仍然会看到 user_id。我怀疑 GA4 可能通过 client_id 链接了它。
我同意,自 3 月 5 日开启同意模式以来,我们开始看到同样的问题。