run(); } run_jamkazam(); /** * Set affiliate tracking cookie if there is an `?affiliate=xxxx` parameter in the URL * The rails set honors this cookie, and a new user will be associated with the affiliate. */ add_action( 'init', 'process_post' ); function process_post() { $affiliate_id = $_GET['affiliate']; $expiration = current_time( 'timestamp' ) + ( DAY_IN_SECONDS * 2 ); #cookies[:affiliate_visitor] = { :value => params[:affiliate], :expires => Time.now + 3600 * 24} # 1 day from now if(isset($affiliate_id)) { setcookie('affiliate_visitor', $affiliate_id, $expiration, '/', '.jamkazam.com'); } }