问题描述
我想通过“curl”使用“GA4 Event Builder”。
活动有效!
当我使用 curl 发送事件时,如果参数有问题,“validationMessages、fieldpath 等”被退回。 但是,当事件有效时,响应是
"{ "validationMessages": [ ] }"。
{"clientId":"1610256318","nonPersonalizedAds":false,"events":[{"name":"view_item","params":{"items":[{"item_id":"SD","item_name":"SD_solution"}],"currency":"KRW"}}]}
$response = curl_exec($curl); curl_close($curl); echo $response; // { "validationMessages": [ ] }
网址 https://www.google-analytics.com/debug/mp/collect?measurement_id=G-xxxx&api_secret=xxxx
当我看到它收到回复时,我认为它运行良好。 但是,Google Analytics 调试视图中不会发生任何事件。
有什么问题?
$url="https://www.google-analytics.com/debug/mp/collect";
$url.="?measurement_id=".$vars['measurement_id'];
$url.="&api_secret=".$vars['api_secret'];
$fields_string=json_encode($payload); // $fields_string={"clientId":"1610256318","currency":"KRW"}}]}
$curl = curl_init($url);
curl_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($curl,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_HTTPHEADER,array('Content-type: application/x-www-form-urlencoded'));
curl_setopt($curl,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
$response = curl_exec($curl);
curl_close($curl);
echo $response; //{ "validationMessages": [ ] }
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)