What's the best setup for the Measurement Protocol?

199 views
Skip to first unread message

Rick Smit

unread,
Jul 14, 2015, 11:09:38 AM7/14/15
to google-analytics-m...@googlegroups.com
Hi all,

I've done some research about the Measurement Protocol and I'm under the impression that I don't need to use analytics.js if I use the MP?

So if I use the measurement protocol withouth analytics.js, retrieving and parsing the _ga cookie is a bit more work but doable.
And if I would use analytics.js on the clientside in combination with the MP I would receive more data from the cookie?

Is this correct? And what would be the best way to implement it? I want to make it as light as possible and accessible to a broad range of devices.

Thanks,

Philip Walton

unread,
Jul 14, 2015, 12:30:03 PM7/14/15
to Rick Smit, google-analytics-m...@googlegroups.com
There's really no good reason not to use analytics.js if you're tracking a website/app that can run JavaScript. The Measurement Protocol is really intended for environments where there isn't already a client library that constructs the hits for you (like a TV or a server stack running a language that a client library doesn't exist for).

--
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/bdf5de90-2802-42e2-86dc-a8cf498ef8f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rick Smit

unread,
Jul 14, 2015, 1:24:12 PM7/14/15
to google-analytics-m...@googlegroups.com, ri...@vigour.io
Amazing response time Philip, thanks a lot!

Do you recommend using analytics.js on the client- or server-side then? They both set the cookie, but the cookie set by analytics.js on the client-side carries more data it seems.
Also, I thought using the measurement protocol would help me not having to use the analytics SDK's in my hybrid apps (web based apps wrapped for native devices) in order to track its usage. But I'm probably totally wrong then?

Thanks!

Philip Walton

unread,
Jul 14, 2015, 1:59:42 PM7/14/15
to Rick Smit, google-analytics-m...@googlegroups.com
I belive analytics.js only works in a browser-type environments, so you can't use it on the server. I think it should work in webviews in hybrid apps though (I'm not 100% how cookies work in webviews).

I thought using the measurement protocol would help me not having to use the analytics SDK's in my hybrid apps (web based apps wrapped for native devices) in order to track its usage.

Trust me on this, if there's a client library available to you that will help you construct measurement protocol hits, you should definitely use it. Constructing those hits yourself is very error-prone.

If you do end up building hits yourself, I'd definitely recommend making sure your hits are valid before sending them.



Reply all
Reply to author
Forward
0 new messages