Passing Analytics referrer data through a form submit

Truffles

New member
Apr 20, 2009
333
3
0
I have a website for my consulting business that has a standard lead capture form on it with some basic info fields. The site uses Google Analytics for conversion tracking but I am going to be plugging all the leads info in to a free CRM that I've found.

What I'm wondering is, if it is possible to pass additional Analytics data through as hidden fields when the person submits their info that I would receive in the email the form sends me. Things like traffic source, keywords if organic or paid, campaign (for email campaigns and such) and all that other fun stuff.

The end goal is to be able to get a clear picture of where specific leads are coming from so I can run the conversion math on my actual pipeline and see where closed deals are truly coming from, not just where I'm getting form submits from since in the end that is irrelevant.
 


I'd be interested if anybody else has done it but I haven't seen it.

If the number of leads coming in is a manageable number (and it probably is since you're manually plugging in leads from a form-to-email) couldn't you just define an Analytics goal (the thank you page from your lead form) and cross reference the timestamp from the submission with your reporting data to zero in on the individual user?
 
My god yes!! You can do this easily w/o google analytics. Have every page on your site conditionally pass $_SERVER = $_SESSION['server'] if(!isset($_SESSION['server'])); That way all info is captured on the entry and not overwritten on subsequent pages. You can just pass all of the entry server data into your e-mail or parse for what you need and then send.

That is the general idea w/o analytics. I have no idea how to pass analytics data on, if it is even possible. I've never actually installed analytics on any of my sites.
 
Thanks for the thoughts guys. Never thought about the timestamp solution...I wonder how accurate that would be given that Analytics tends to have delays with updating data.

Thanks for the server session info snippet jimmy, however I'm not really knowledgeable enough to code the PHP for it (just know how to hack a bit of PHP at this point). Without asking you to actually give me all the code for doing that, can you tell me what sorts of PHP things I would need to know for that to make sense and I can research it?

I'm POSITIVE it is possible to pass the analytics data through. Every major CRM out there (MS Dynamics, Salesforce, etc.) is able to integrate in a way that allows you to feed Analytics data directly in to it so they must be doing it somehow.
 
Can you maybe set it up as an ecommerce goal and assign each form submission an order ID? You'd still have to login to GA to check each order ID manually, but its a start.
 
Here.. name this script test.php, and run it 3 times.. I have a session key for the first run, so that the server variable catches the HTTP_REFERER also. After the 3rd time, look at the source code because print_r doesn't display right in a browser.

[high=php]
<?php

session_start();

echo '<a href="install.php">Run again</a><br/>';
if(!isset($_SESSION['firstrun'])){
$_SESSION['firstrun'] = 'on';
} else {
if(!isset($_SESSION['server'])){
$_SESSION['server'] = $_SERVER;
} else {
print_r($_SESSION['server']);
}

}

?>
[/high]

More info here:
PHP Tutorial - Session