Changeset 1927465
- Timestamp:
- 08/20/2018 03:40:51 PM (8 years ago)
- Location:
- pepperjam-pixel/trunk
- Files:
-
- 5 edited
-
includes/class-pj-pixel-integration.php (modified) (2 diffs)
-
includes/class-pj-pixel.php (modified) (2 diffs)
-
includes/data-pj-form-fields.php (modified) (1 diff)
-
pepperjam.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pepperjam-pixel/trunk/includes/class-pj-pixel-integration.php
r1511998 r1927465 78 78 // Tracking code 79 79 add_action( 'wp_footer', array( $this, 'maybe_display_pj_pixel' ), 99 ); 80 81 // Manage click_id cookie 82 add_action('init', array($this, 'maybe_write_click_id_cookie')); 80 83 81 84 // Test mode meta box for orders … … 234 237 echo $pixel; 235 238 } 239 240 public function maybe_write_click_id_cookie() 241 { 242 $url_params = array_change_key_case($_GET); 243 if(isset($url_params[PJ_CLICKID_URL_PARAM])) 244 { 245 $click_id = $url_params[PJ_CLICKID_URL_PARAM]; 246 $click_ids = array(); 247 248 if(isset($_COOKIE[PJ_CLICK_ID_COOKIE])) 249 { 250 $click_ids = $this->get_click_id_cookie_as_array(); 251 } 252 253 // Put click id into an associative array so that any existing click id with the same value is overwritten 254 $click_ids[$click_id] = array('timestamp' => time(), 'click_id' => $click_id); 255 256 $cookie_expiration_unix_time = time()+60*60*24*365*10; // 10 year expiration (more or less) 257 setcookie(PJ_CLICK_ID_COOKIE, json_encode($click_ids), $cookie_expiration_unix_time, '/'); 258 } 259 } 260 261 public static function get_click_id_cookie_as_array() 262 { 263 return json_decode(stripslashes($_COOKIE[PJ_CLICK_ID_COOKIE]), true); 264 } 236 265 } -
pepperjam-pixel/trunk/includes/class-pj-pixel.php
r1753433 r1927465 164 164 $this->integration_type = isset( $options['pj_integration_type'] ) ? $options['pj_integration_type'] : ''; 165 165 $this->tracking_url = isset( $options['pj_tracking_url'] ) ? $options['pj_tracking_url'] : ''; 166 $this->lookback_days = isset( $options['pj_lookback_days'] ) ? $options['pj_lookback_days'] : 60; 166 167 $this->date_implemented = isset( $options['pj_date_implemented'] ) ? $options['pj_date_implemented'] : ''; 167 168 $this->_is_testmode = ( isset( $options['pj_testmode'] ) && 'yes' === $options['pj_testmode'] ); … … 193 194 // Process Order Data 194 195 $order_params = $this->_process_order_data(); 196 197 // Get comma delimited string of stored click_ids created within the lookback period 198 $click_ids_in_cookie = PJ_Pixel_Integration::get_click_id_cookie_as_array(); 199 if(isset($click_ids_in_cookie)) 200 { 201 $cutoffTimestamp = time() - 60*60*24*$this->lookback_days; 202 $click_id_params = array(); 203 foreach($click_ids_in_cookie as $click_id => $data) 204 { 205 if($data['timestamp'] > $cutoffTimestamp) 206 { 207 $click_id_params[] = $click_id; 208 } 209 } 210 $base_params['CLICK_ID'] = implode(",", $click_id_params); 211 } 195 212 196 213 // Merge data -
pepperjam-pixel/trunk/includes/data-pj-form-fields.php
r1511998 r1927465 31 31 'default' => 'https://t.pepperjamnetwork.com' 32 32 ), 33 'pj_lookback_days' => array( 34 'title' => __( 'Lookback period', 'pepperjam' ), 35 'description' => __( 'Number of days.', 'pepperjam' ), 36 'type' => 'text', 37 'options' => array( 38 'https://t.pepperjamnetwork.com' => 'https://t.pepperjamnetwork.com' 39 ), 40 'default' => '60' 41 ), 33 42 'pj_date_implemented' => array( 34 43 'title' => __( 'Program Implementation Date', 'pepperjam' ), -
pepperjam-pixel/trunk/pepperjam.php
r1753433 r1927465 4 4 * Plugin URI: https://www.pepperjam.com/ 5 5 * Description: Extend the WooCommerce platform with Pepperjam pixel. 6 * Version: 1.0. 86 * Version: 1.0.9 7 7 * Author: Brad Cavanaugh <bradkcavanaugh@gmail.com> 8 8 * Author URI: https://bradkcavanaugh.com … … 125 125 $this->define( 'PJ_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 126 126 $this->define( 'PJ_LOG_DIR', $upload_dir['basedir'] . '/pj-logs/' ); 127 } 128 129 /** 127 $this->define( 'PJ_CLICK_ID_COOKIE', 'pepperjam_click_ids' ); 128 $this->define( 'PJ_CLICKID_URL_PARAM', 'clickid' ); 129 } 130 131 /** 130 132 * Define constant if not already set. 131 133 * -
pepperjam-pixel/trunk/readme.txt
r1753433 r1927465 3 3 Tags: WooCommerce, Pepperjam, Pixel, Woo, Commerce 4 4 Requires at least: 3.0.1 5 Tested up to: 4. 8.15 Tested up to: 4.9.8 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 22 22 23 23 1. Upload the plugin files to the `/wp-content/plugins/plugin-name` directory, or install the plugin through the WordPress plugins screen directly. 24 1. Activate the plugin through the 'Plugins' screen in WordPress. 25 1. Use the WooCommerce->Settings->Integration->Pepperjam Pixel screen to configure the plugin. 26 1. Enter the 'Program ID' as provided by your Pepperjam Account manager. 27 1. Select the 'Integration Type' as provided by your Pepperjam Account manager. 28 1. Select the 'Tracking Url' as provided by your Pepperjam Account manager. 29 1. (optional) Set the 'Program Implementation Date'. If you are unsure of what date to use, consult with your Pepperjam Account manager. 24 2. Activate the plugin through the 'Plugins' screen in WordPress. 25 3. Use the WooCommerce->Settings->Integration->Pepperjam Pixel screen to configure the plugin. 26 4. Enter the 'Program ID' as provided by your Pepperjam Account manager. 27 5. Select the 'Integration Type' as provided by your Pepperjam Account manager. 28 6. Select the 'Tracking Url' as provided by your Pepperjam Account manager. 29 7. Set the lookback period as provided by your Pepperjam Account manager. 30 8. (optional) Set the 'Program Implementation Date'. If you are unsure of what date to use, consult with your Pepperjam Account manager. 30 31 31 32 == Changelog == 33 34 = 1.0.9 = 35 * Added first party cookie support for Safari ITP 2.0 32 36 33 37 = 1.0.8 =
Note: See TracChangeset
for help on using the changeset viewer.