Changeset 2353047
- Timestamp:
- 08/05/2020 10:56:11 AM (5 years ago)
- Location:
- pureclarity-for-woocommerce/trunk
- Files:
-
- 5 edited
-
includes/class-pureclarity-state.php (modified) (2 diffs)
-
includes/class-pureclarity-template.php (modified) (1 diff)
-
js/pc.js (modified) (1 diff)
-
pureclarity.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pureclarity-for-woocommerce/trunk/includes/class-pureclarity-state.php
r2351535 r2353047 155 155 $product = $this->get_wc_product(); 156 156 if ( ! empty( $product ) ) { 157 $data = array( 158 'id' => (string) $product->get_id(), 159 'sku' => $product->get_sku(), 157 $categories = $product->get_category_ids(); 158 $category = ( count( $categories ) > 0 ) ? array_shift( $categories ) : null; 159 $data = array( 160 'id' => (string) $product->get_id(), 161 'sku' => $product->get_sku(), 162 'category_id' => $category, 160 163 ); 161 164 wp_reset_postdata(); … … 290 293 } 291 294 295 /** 296 * Works out what page type this page is, based on the target 297 * 298 * @return array 299 */ 300 public function get_page_view_context() { 301 return $this->get_page_context( $this->get_page_type() ); 302 } 303 304 /** 305 * Works out what page type this page is, based on WP functions 306 * 307 * @return string 308 */ 309 private function get_page_type() { 310 $page_type = ''; 311 if ( is_front_page() ) { 312 $page_type = 'homepage'; 313 } elseif ( is_search() ) { 314 $page_type = 'search_results'; 315 } elseif ( is_product_category() || is_shop() ) { 316 $page_type = 'product_listing_page'; 317 } elseif ( is_product() ) { 318 $page_type = 'product_page'; 319 } elseif ( is_cart() ) { 320 $page_type = 'basket_page'; 321 } elseif ( is_account_page() ) { 322 $page_type = 'my_account'; 323 } elseif ( is_wc_endpoint_url( 'order-received' ) ) { 324 $page_type = 'order_complete_page'; 325 } elseif ( is_checkout() ) { 326 $page_type = ''; 327 } elseif ( is_page() ) { 328 $page_type = 'content_page'; 329 } 330 return $page_type; 331 } 332 333 /** 334 * Gets page-type specific context (e.g. product page - product ID) 335 * 336 * @param string $page_type Page Type - the page type currently being viewed. 337 * 338 * @return array 339 */ 340 protected function get_page_context( $page_type ) { 341 $context = []; 342 343 if ( $page_type ) { 344 $context['page_type'] = $page_type; 345 } 346 347 switch ( $page_type ) { 348 case 'category_listing_page': 349 case 'product_listing_page': 350 $category_id = $this->get_category_id(); 351 if ( $category_id ) { 352 $context['category_id'] = $this->get_category_id(); 353 } 354 break; 355 case 'product_page': 356 $product = $this->get_product(); 357 if ( is_array( $product ) ) { 358 $context['product_id'] = $product['id']; 359 if ( $product['category_id'] ) { 360 $context['category_id'] = $product['category_id']; 361 } 362 } 363 break; 364 } 365 366 return $context; 367 } 292 368 } -
pureclarity-for-woocommerce/trunk/includes/class-pureclarity-template.php
r2348355 r2353047 104 104 'product' => $pureclarity_session->get_product(), 105 105 'categoryId' => ( is_shop() ? '*' : $pureclarity_session->get_category_id() ), 106 'page_view' => $pureclarity_session->get_page_view_context(), 106 107 'tracking' => array( 107 108 'accessKey' => $pureclarity_settings->get_access_key(), -
pureclarity-for-woocommerce/trunk/js/pc.js
r2242392 r2353047 19 19 p.src = u;p.async=1;h.parentNode.insertBefore(p, h); 20 20 })(window, document, 'script', this.config.tracking.apiUrl, '_pc'); 21 _pc('page_view' );21 _pc('page_view',this.config.page_view); 22 22 23 23 if (this.config.product){ -
pureclarity-for-woocommerce/trunk/pureclarity.php
r2351535 r2353047 8 8 * Description: Increase revenues by 26% in your WooCommerce store with AI-based real-time personalization. Integrates with PureClarity's multi-award winning ecommerce personalization software. 9 9 * Plugin URI: https://www.pureclarity.com 10 * Version: 2.3. 010 * Version: 2.3.1 11 11 * Author: PureClarity 12 12 * Author URI: https://www.pureclarity.com/?utm_source=marketplace&utm_medium=woocommerce&utm_campaign=aboutpureclarity -
pureclarity-for-woocommerce/trunk/readme.txt
r2351535 r2353047 4 4 Requires at least: 4.7 5 5 Tested up to: 5.4.2 6 Stable tag: 2.3. 06 Stable tag: 2.3.1 7 7 License: GPLv3 or later 8 8 License URI: https://www.gnu.org/licenses/gpl.html … … 138 138 * 3. Change the fallback to be a custom way to trigger order events for those with completely custom order received pages. 139 139 * Also fixed a minor issue with user IDs and guest orders being sent as 0, instead of blank 140 141 = 2.3.1 = 142 * Improvements to page view event to send page type and context
Note: See TracChangeset
for help on using the changeset viewer.