Using Google Analytics Cookies in Web Forms
Justin from EpikOne wrote a great piece earlier this week explaining how to extract source, medium and campaign information from Google Analytics to insert in contact or lead forms. Essentially, it takes the data already stored about the visitor, and adds those values to hidden fields in the form. This means when your form submission comes through, it will contain valuable info about the visitor. Wouldn’t it be cool to get a lead email that looks like this:
Name: Joe Smith
Phone: 555-555-5555
email: joe@email.com
Notes: I’m interested in your product or service, please call me ASAP.
Visitor Source: Google search for ‘dallas widget maker’
Sure, you can always tell from the Google Analytics reports the conversion rate of each medium and source, but this allows to you tie each individual lead or contact form to a source. Why is this better? Well, all leads are not equal in value. If you do high volume on the Internet, you should probably know that 30% of your PPC leads turn into customers, but only 15% of your email leads do. Attaching this kind of tracking will enable you to make this next step calculation that would have otherwise been impossible.
So again, great job Justin! We went back and forth a few times in the comments about some ideas for improving the code (incidently, I had written the exact same program for my employer last week, but hadn’t published it). I definitely suggest implementing this on your lead forms if you use Google Analytics.

