Is there a simple script that can check whether I got traffic from Google Organic or PPC? That would not involve using any google API's.
Would something like this be enough?
if (document.referrer) {
var ref = document.referrer;
if (
ref.toLowerCase.search("http://www.google.co.uk/aclk?") ||
ref.toLowerCase.search("www.googleadservices.com")
) {
alert("PPC");
}
if (ref.toLowerCase.search("http://www.google.co.uk/url?")) {
alert("Organic");
}
}
else {
alert("no referrer");
}
Or maybe on server side?
Definitely on the server side and yes, that would work for the vast majority of your traffic.
Maybe you should optimize your string comparison a little bit more (maybe regular expressions) for cases where users may be using google with HTTPS or another domain than .co.uk.
Why don't you use Google Analytics though?