How to Track Lead Source and Referrer.

Posted on 2012-04-12
Last Modified: 2012-04-27
Hi, My client has a website and an enquiry form. Every time he gets an enquiry he wants to track where the lead came from (Referrer [can be a search engine or a 3rd party advertiser]), the keyword they used, the search engine used, the landing page etc etc.

Whats the best solution out there for this? I'm pretty good with PHP and Javascript. Tried using Google Analytics cookies, they are not that accurate.

Thanks guys in advance.
Question by:udara22
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 17

Expert Comment

by:Kent Dyer
ID: 37840874
You need a database..  If you have MySQL you should be set.

Use your database as your source of record..
You need a login/password
Data Entry Screen
Edit Screen



Author Comment

ID: 37840883
Hi Kent, Thanks. I have a Joomla website running. I used Google Analytics cookies to extract data and store into the database next to each of the enquiries in the Joomla backend. its all set.

But the issue is not storing information. The issue is which technology to use to grab the user information?

LVL 17

Expert Comment

by:Kent Dyer
ID: 37840904
OK..  you need to do the CRUD principle to your database..  You have to be "C"reate (INSERT) into the database..  You have to "R"ead (SELECT) from the database..  You have to be able to "U"pdate and "D"elete..  If you can login to phpMyAdmin, you should have the db connectors from your pHP pages..

Not sure what else I can provide?

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 37840965
Kent, how can I grab what users typed on google?
LVL 36

Expert Comment

ID: 37841338
I'm a little surprised that Google Analytics is inaccurate with regards to this, as I would imagine referrers to be high on the list of things it provides.

Nonetheless, if your users came from Google, which holds the user's query string in the URL, you can grab it.

With PHP, you can refer to the $_SERVER['HTTP_REFERER'] superglobal and parse it to obtain the query string. See for some more details on one way to do this.
LVL 110

Expert Comment

by:Ray Paseur
ID: 37843731
Kent, how can I grab what users typed on google?
You probably can't.  And I am not sure that Google would want you to have this information -- it's their proprietary business data.  I believe that Google Analytics will be one of your best tools.  You can capture some additional information if you want to get into cross-platform cookie tracking.  Learn about Undertone Networks and DoubleClick.  I am assuming that if you have foreign sites that advertise and refer clients, you are already tracking this via the request link, right?  You can get a little more information if you look in $_SERVER['HTTP_REFERER'].

Author Comment

ID: 37844024
@Ray_Paseur : Hi Ray and Zylock. The issue with Google Analytics is, sometimes its referer and keywrod cookie (__utmz) doesnt get updated if the user has visited the website before.  For an example, if I go to Google and type "keyword one" and land on my website and the google cookie is set referer to "Google", and if I go and click on a 3rd party advertising banner right after that, sometime google still has referer as "Google". This happends a lot on IE 7. So thats why I was looking for a more PHP based solution rather than cookie and JS based.

My media agency uses DoubleClick. But its just for media agencies isnt ? Not fur standard consumers?

Accepted Solution

udara22 earned 0 total points
ID: 37879678
Sorry, not quite what I expected.

Author Closing Comment

ID: 37901245
Sorry, not quite what I expected.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question