nutlog13 Posted May 25, 2010 Share Posted May 25, 2010 Sorry, I've done a lot of searching but can't tell if this is standard fare that I don't quite understand, or if it's something not very common or easy to do with OSC. We're setting up our site to receive hits from various referrers, and it needs a session variable to track where the click came from, and that that user followed their visit through to a purchase. So the string coming from the referrer (say "Some Company" with ID # ABC123) is something like ?referrerName=SomeCompany&refID=ABC123... i.e. http://www.mystore.com/catalog/index.php?referrerName=SomeCompany&refID=ABC123 How do I add this URL string or set a session variable, so EVERY page the whole time I'm browsing retains that string? i.e. http://www.mystore.com/catalog/product_info.php?cPath=22_31&products_id=43?referrerName=SomeCompany&refID=ABC123 http://www.mystore.com/catalog/checkout_shipping.php?referrerName=SomeCompany&refID=ABC123 From what I've gathered it sounds like it's something in application_top.php, but I just can't quite figure out what. Hopefully it's simple and straightforward, common practice for someone else! :) Any help on this would be great. Thanks! Link to comment Share on other sites More sharing options...
nutlog13 Posted May 26, 2010 Author Share Posted May 26, 2010 Bump! Link to comment Share on other sites More sharing options...
nutlog13 Posted June 3, 2010 Author Share Posted June 3, 2010 bump Link to comment Share on other sites More sharing options...
nutlog13 Posted June 8, 2010 Author Share Posted June 8, 2010 Anybody? Link to comment Share on other sites More sharing options...
germ Posted June 9, 2010 Share Posted June 9, 2010 One way: In /catalog/includes/application_top.php before this code: // set SID once, even if empty $SID = (defined('SID') ? SID : ''); Add this code (modify it to include your referrer names and ID's): $link_refs = array( "Acme" => "a1b2c3", "Nutz-R-Us" => "f9c4l5", "Edsel" => "h9k73b", "WhoozWho" => "q9z5g4", "PartsIzParts" => "u2m3r1"); if ( $referrerName = $_GET['referrerName'] ) { if ( $refID = $_GET['refID'] ) { if ( $link_refs[$referrerName] != "" ) { if ( ! tep_session_is_registered('referrerName') ) { tep_session_register('referrerName'); $refID = $link_refs[$referrerName]; tep_session_register('refID'); } } } } That part identifies and registers the referrer names and ID's. To include them in the links this code in /catalog/includes/functions/html_output.php //// // The HTML href link wrapper function function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) { global $request_type, $session_started, $SID; Change the last line in that code to this: global $request_type, $session_started, $SID,$referrerName,$refID; Then in that same function BEFORE this code: if (isset($_sid)) { $link .= $separator . tep_output_string($_sid); } Add this code: if ( tep_session_is_registered('referrerName') ) { $link .= $separator . "referrerName=" . tep_output_string($referrerName); $separator = '&'; } if ( tep_session_is_registered('refID') ) { $link .= $separator . "refID=" . tep_output_string($refID); } This worked in a test area I have. BACKUP ALL FILES BEFORE EDITING. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
nutlog13 Posted June 9, 2010 Author Share Posted June 9, 2010 Thank you very much, Jim. That is definitely very helpful. :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.