.. and then create a TV called GAgoal where you enter a value when you want that specific page to be tracked?
It might be easier to use a gotoID in eForm (instead of a thank you chunk) and TVs, though. Especially if he wants to track other specific pages that don’t have anything to do with eForm. But either way would work (or both, really - you could just put both the TV and placeholder in your template).
@ZAP: SammyR wants Google Analytics to track the same URL differently depending on the state of the form, so setting a TV for the page will always return the same thing. But eForm functions sounds exactly like what I was thinking of for dynamically setting a placeholder to represent the pagename that we send to GA - thanks for the lead.
Quote from: netProphET at Dec 07, 2007, 06:18 PMIt might be easier to use a gotoID in eForm (instead of a thank you chunk) and TVs, though. Especially if he wants to track other specific pages that don’t have anything to do with eForm. But either way would work (or both, really - you could just put both the TV and placeholder in your template).
@ZAP: SammyR wants Google Analytics to track the same URL differently depending on the state of the form, so setting a TV for the page will always return the same thing. But eForm functions sounds exactly like what I was thinking of for dynamically setting a placeholder to represent the pagename that we send to GA - thanks for the lead.
Have you tried using a gotoID instead of a thankyou chunk? If you do that, your thank you page will be a completely different document, so you can add your GA goal-tracking code to it and it will definitely be tracked separately. I would think that would be the easiest way to do this, but I think that you can include goal code in your thankyou chunk as well (depending upon how you set up GA to recognize that the goal was completed).
$_SESSION['info']['thing1'] = $fields['thing1']; $_SESSION['info']['thing2'] = $fields['thing2'];
$modx->setPlaceholder('thing1', $_SESSION['info']['thing1']); $modx->setPlaceholder('thing2', $_SESSION['info']['thing2']); unset($_SESSION['info']);
Hi Zap,
Sure - you can just add this code to your existing function.
<?php function eForm2db( &$fields ) { global $modx; $fields['remote_addr']=$_SERVER['REMOTE_ADDR']; $fields['remote_host']=$_SERVER['REMOTE_HOST']; $fields['user_agent']=$_SERVER['HTTP_USER_AGENT']; // Init our array $dbTable = array(); $dbTable['Title'] = $modx->db->escape($fields['Title']); $dbTable['Name'] = $modx->db->escape($fields['Name']); $dbTable['Company'] = $modx->db->escape($fields['Company']); $dbTable['Address'] = $modx->db->escape($fields['Address']); $dbTable['Telephone'] = $modx->db->escape($fields['Telephone']); $dbTable['Fax'] = $modx->db->escape($fields['Fax']); $dbTable['email'] = $modx->db->escape($fields['email']); $dbTable['Quality'] = $modx->db->escape($fields['Quality']); $dbTable['Content'] = $modx->db->escape($fields['Content']); $dbTable['Request'] = $modx->db->escape($fields['Request']); $dbTable['Metal'] = $modx->db->escape($fields['Metal']); $dbTable['IP'] = $_SERVER['REMOTE_ADDR']; $dbTable['Host'] = $_SERVER['REMOTE_HOST']; $dbTable['Agent'] = $_SERVER['HTTP_USER_AGENT']; // Run the db insert query $dbQuery = $modx->db->insert($dbTable, 'feedback' ); return true; } ?>