Google Analytics as per the Collection Protocol.
Specifically useful for MXit & Mobile sites.
There are 2 different ways you can use this library.
PHP
- Non-blocking using
exec
&cURL
. (src) - Blocking using
file_get_contents
, butcURL
-less.
Features
- Easy config
- Autohit
- Include and forget
Non-blocking
Make sure your server has php_curl
installed.
Blocking
Make sure your server has the allow_url_fopen
flag set to On
.
PHP
Open and edit googleanalytics.php
.
require_once("googleanalytics.php");
C#
Events
GoogleAnalytics ga = new GoogleAnalytics();
ga.GoogleAnalyticsTracking(Request.Url.GetLeftPart(UriPartial.Authority), HttpUtility.UrlEncode(Request.Url.PathAndQuery), Page.Title, "event", "click", "action", "label");
PageViews
GoogleAnalytics ga = new GoogleAnalytics();
ga.GoogleAnalyticsTracking(Request.Url.GetLeftPart(UriPartial.Authority), HttpUtility.UrlEncode(Request.Url.PathAndQuery),Page.Title, "pageview", "", "", "");
Easy as pie.
Pull requests welcomed.
:{D