cannot trigger collect with file_get_contents or curl for one particular tracking ID

466 views
Skip to first unread message

Andy Chian

unread,
Jul 14, 2015, 2:03:54 PM7/14/15
to google-analytics-m...@googlegroups.com
Hello all,

I have a php script that hit the collect URL like this


When I hit the php script through my phone, nothing happens, but if I hit the URL within the file_get_contents directly, I can see a hit in Real-Time Reporting right away.

Even more weird, the exact same PHP code works for the other 4 tracking IDs we have, just not this one: UA-21277314-1


I've also tried to use curl with user-agent instead of file_get_contents

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_USERAGENT => 'Autofusion Call Tracking cURL Request'
));
$resp = curl_exec($curl);
echo 'Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl);
curl_close($curl);

There is no error and code return 0.  Still, no good.

I cannot see how the same code could work for one, but not another.    Is there something with the account itself that could have caused this?   Thanks for any input.


Philip Walton

unread,
Jul 14, 2015, 2:39:31 PM7/14/15
to Andy Chian, google-analytics-m...@googlegroups.com
I cannot see how the same code could work for one, but not another.    Is there something with the account itself that could have caused this?   Thanks for any input.

Most likely.

That URL looks fine to me, so perhaps you're sending it to the wrong tracking ID or there's some filter set up to reject certain types of hits or something like that.



--
You received this message because you are subscribed to the Google Groups "google-analytics-measurement-protocol" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-analytics-measure...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-analytics-measurement-protocol/76b9688b-3443-436e-ace9-6a55730ac6f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andy Chian

unread,
Jul 14, 2015, 6:35:32 PM7/14/15
to google-analytics-m...@googlegroups.com
@Philip: Thanks for your response.  However, it cannot be a wrong tracking ID because if I visit the google link directly, I can see the hit in Real-Time reporting right away.  Like I said, It's pretty weird.

Andy Chian

unread,
Jul 28, 2015, 7:06:47 PM7/28/15
to google-analytics-measurement-protocol, hch...@gmail.com
I have finally figured it out.  There was a filter that filtering out our colocation IP, so requests using file_get_contents or curl are getting filtered since the request is actually originating from the colocation.  It's one of the duh and aha moments at the same time.  Thanks.


On Tuesday, July 14, 2015 at 11:03:54 AM UTC-7, Andy Chian wrote:
Reply all
Reply to author
Forward
0 new messages