Google Analytics Measurement Protocol
I tried to use google analytics to track some more custom data. So I thought I use the events. The following is the code I tried where I replaced the uuid and user agent : <?php function gen_uuid() { return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0x0fff ) | 0x4000, mt_rand( 0, 0x3fff ) | 0x8000, mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); } $data = array( 'v' => 1, 'tid' => 'UA-********-**', 'cid' => gen_uuid(), 't' => 'event' ); $data['ec'] = "category"; $data['ea'] = "product";