Saturday, April 7, 2012

Get contact info with custom analytics to database

Had a need to get more details about the contacts leads (contact us page) and created this custom analytics that might be interesting for someone out there.

This code is valuable and I will not release it to the public unless there's huge demand for it but I will explain what is going into building it.

First there is the usual database connections but some tricks required to create multiple connections, which can work for off-site and different hosts (outside of the current one) - this is mainly done for backup but also because the internal website software managing the leads is on a separate host (done mainly because it's heavy enough to slow down the public site).

Next we have the part that tracks the landing page along with medium, browser and OS (inspired by Google analytics), I use a cookie that expires after about a month.

The data is stored in a table, database dedicated for this (specially since an avarage traffic site will gain a few thousands of new visitors per month/few weeks) the table will grow pretty rapidly and clean up can be scheduled for older entries that are over a month, but overall mysql can take a lot of entries and I didn't have to do that yet without seeing any slowdown (we are on a VPS mind you).

This part translates to getting a line of code at the top of every page you want tracked and it will have to be converted to php (if it isn't already) but it's easy for CMS type software like wordpress since it's as simple as going to the index and adding it to the top.

Finally the code needs to be added to the contact us page when being submitted. This will vary depending on your method of contact page if it's custom or if it's CMS type like wordpress plugin, specifically the popular "contact form 7" explanation can be found here.

The result is receiving leads in specific software which helps keeping track, and following up to convert (this is also software I have built) and when you get the lead it will have keywords, medium (referral, google or other search, or direct hit - just like google analytics). Helping you figure out how people find you and investing in the good methods that convert into real money for your business.

And that should do it for the brief, if you have interest in this software or even in my help setting it up for you please let me know in the comments, by email (found at the bottom) and we can talk something out.

No comments: