I'm using Google Measurement Protocol to trigger views in GA. I'm wondering how to trigger pageviews from mobile web (not mobile apps).
I've checked documentation and there's no mention of differentiating desktop, mobile or tablet. I assumed it would do this via the user-agent, but the below user-agent is for a Samsung Galaxy S6 Edge, but tracks as desktop.
Is there a device switch I'm missing? Thank you.
$ch = curl_init();
$params =
['t' => 'pageview',
'tid' => 'UA-XXXXXXXX-1',
'v' => '1',
'cid' => "9618da12-7db9-0128-8117-2cac0d35e05f",
'ds' => 'web',
'dl' => ‘http://www.example.com’,
'ua' => ‘Mozilla/5.0 (Linux; Android 5.1.1; SM-G928X Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36’,
'geoid' => ‘US’,
'dr' => ‘http://www.referingsite.com’,
'ul' => 'en-us',
'de' => 'UTF-8',
'sd' => '24-bit',
'je' => '0'];
curl_setopt_array($ch, array(
CURLOPT_URL => 'https://www.google-analytics.com/collect',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => http_build_query($params)
));
curl_exec($ch);
curl_close($ch);