<?php function opt_forms_tracking() { global $wpdb; global $dwpc; $data = array(); $visitor_cookie = $_REQUEST['visitor_cookie']; $impression_id = $_REQUEST['impression_id']; $visitor = $wpdb->get_row('SELECT * FROM '.DWPC_DB_PREFIX.'dwpc_visitors WHERE cookie="'.$visitor_cookie.'"',ARRAY_A); $impression = $wpdb->get_row('SELECT * FROM '.DWPC_DB_PREFIX.'dwpc_impressions WHERE text_id="'.$impression_id.'"',ARRAY_A); $data['filtered'] = $visitor['filtered']; $data['time_created'] = current_time('mysql'); $data['dwpc_impression_id'] = $impression['id']; $data['dwpc_visitor_id'] = $visitor['id']; $data['opt_form_id'] = $_REQUEST['forms_id']; $data['opt_optin_link_id'] = $_REQUEST['links_id']; $data['tracking_type'] = ucwords($_REQUEST['tracking_type']); $data['opt_split_test_item_id'] = $_REQUEST['split_test_item_id']; $dwpc->insert(OPT_DB_PREFIX.'opt_forms_tracking',$data); header('Access-Control-Allow-Origin: *'); header("Content-type: text/javascript"); die(); } function opt_links_tracking(){ global $wpdb; global $dwpc; $data = array(); $visitor_cookie = $_REQUEST['visitor_cookie']; $impression_id = $_REQUEST['impression_id']; $visitor = $wpdb->get_row("SELECT * FROM ".DWPC_DB_PREFIX."dwpc_visitors WHERE cookie='".$visitor_cookie."'",ARRAY_A); $impression = $wpdb->get_row("SELECT * FROM ".DWPC_DB_PREFIX."dwpc_impressions WHERE text_id='".$impression_id."'",ARRAY_A); $data['filtered'] = $visitor['filtered']; $data['time_created'] = current_time('mysql'); $data['dwpc_impression_id'] = $impression['id']; $data['dwpc_visitor_id'] = $visitor['id']; $data['opt_optin_link_id'] = $_REQUEST['links_id']; $data['tracking_type'] = ucwords($_REQUEST['tracking_type']); $dwpc->insert(OPT_DB_PREFIX.'opt_optin_link_tracking',$data); $response = array('opt_link_tracking_id'=>$wpdb->insert_id); header('Access-Control-Allow-Origin: *'); header("Content-type: text/javascript"); echo json_encode($response); die(); } ?>