3 ms·
Hi user24, As the author of the post, I'd like to respond. When I wrote the code for this example, my main point was simply to illustrate how to extract certa
by jawns 16y ago
Hi user24,
As the author of the post, I'd like to respond.
When I wrote the code for this example, my main point was simply to illustrate how to extract certain useful bits of data from Google's referrer URL, and explain what they mean.
I was not intending it to be production-ready code -- that's why there's no error handling.
Indeed, as one other commenter noted, the storing of the values in a database could have been left off entirely.
What's the point of the submission, you ask? Well, Google's referrer URL uses variables that are not very intuitive. Who would know, just by looking at it, that the "cd" value represented the position at which a link appears on the Google search results page?
So I wrote this post for people who might see this referrer in their logs and want to know what it means. And while Google Analytics and Google Webmaster Tools do provide essentially the same information (and more!) there may be limited cases in which a person might want to use the information contained in the referrer URL within their script, e.g. "Hey, you searched for such-and-such. Here are some other posts you might like."
- user24 16y agoHey, I didn't mean to offend. And I've also been guilty of releasing non-production-ready code. And if you'd just included that kind of disclaimer clearly up front I don't think I'd have felt so compelled to comment on this. As far as the point of the submission. Yes, I found it interesting to learn about Google's referers, but I think I'd rather have just read about that, rather than seeing the code too. It was unclear whether the article was "Hey lets deconstruct google referers" or "Hey lets play with some PHP". The former is interesting, the latter not. Thanks for the reply.