Changeset 3258914
- Timestamp:
- 03/20/2025 07:01:05 AM (13 months ago)
- Location:
- usermaven
- Files:
-
- 8 edited
- 1 copied
-
tags/1.1.8 (copied) (copied from usermaven/trunk)
-
tags/1.1.8/README.txt (modified) (1 diff)
-
tags/1.1.8/includes/class-usermaven-woocommerce.php (modified) (14 diffs)
-
tags/1.1.8/includes/class-usermaven.php (modified) (1 diff)
-
tags/1.1.8/usermaven.php (modified) (2 diffs)
-
trunk/README.txt (modified) (1 diff)
-
trunk/includes/class-usermaven-woocommerce.php (modified) (14 diffs)
-
trunk/includes/class-usermaven.php (modified) (1 diff)
-
trunk/usermaven.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
usermaven/tags/1.1.8/README.txt
r3241679 r3258914 6 6 Tested up to: 6.7.1 7 7 Requires PHP: 5.6 8 Stable tag: 1.1. 68 Stable tag: 1.1.8 9 9 License: Massachusetts Institute of Technology (MIT) license 10 10 License URI: https://opensource.org/licenses/MIT -
usermaven/tags/1.1.8/includes/class-usermaven-woocommerce.php
r3241679 r3258914 235 235 // Create items array with single product 236 236 $items = array(array( 237 'product_id' => (int) $product->get_id(),237 'product_id' => (int) $product->get_id(), 238 238 'product_name' => (string) $product->get_name(), 239 'price' => (float) $product->get_price(),240 'currency' => (string) get_woocommerce_currency(),241 'type' => (string) $product->get_type(),242 'categories' => array_map('strval', $categories),243 'sku' => (string) $product->get_sku(),239 'price' => (float) $product->get_price(), 240 'currency' => (string) get_woocommerce_currency(), 241 'type' => (string) $product->get_type(), 242 'categories' => array_map('strval', $categories), 243 'sku' => (string) $product->get_sku(), 244 244 'stock_status' => (string) $product->get_stock_status() 245 245 )); 246 246 247 $event_attributes = array( 248 ...$items[0], 249 247 $event_attributes = array_merge($items[0], array( 250 248 // Items Array 251 249 'items' => $items, 252 ) ;250 )); 253 251 254 252 // Send the event … … 294 292 $items = array(array( 295 293 // Product Information 296 'product_id' => (int) $product_id, 297 'product_name' => (string) $product->get_name(), 298 'product_sku' => (string) $product->get_sku(), 299 'product_type' => (string) $product->get_type(), 300 'categories' => array_map('strval', $categories), 301 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 302 294 'product_id' => (int) $product_id, 295 'product_name' => (string) $product->get_name(), 296 'product_sku' => (string) $product->get_sku(), 297 'product_type' => (string) $product->get_type(), 298 'categories' => array_map('strval', $categories), 299 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 303 300 // Quantity and Price Details 304 'quantity' => (int) $quantity, 305 'unit_price' => $unit_price, 306 'regular_price' => (float) $product->get_regular_price(), 307 'sale_price' => (float) $product->get_sale_price(), 308 'price_total' => $price_total, 309 'is_on_sale' => (bool) $product->is_on_sale(), 310 'currency' => (string) get_woocommerce_currency(), 311 301 'quantity' => (int) $quantity, 302 'unit_price' => $unit_price, 303 'regular_price' => (float) $product->get_regular_price(), 304 'sale_price' => (float) $product->get_sale_price(), 305 'price_total' => $price_total, 306 'is_on_sale' => (bool) $product->is_on_sale(), 307 'currency' => (string) get_woocommerce_currency(), 312 308 // Stock Information 313 'stock_status' => (string) $product->get_stock_status(), 314 'stock_quantity' => $product->get_stock_quantity() !== null ? 315 (int) $product->get_stock_quantity() : 316 null, 317 'is_in_stock' => (bool) $product->is_in_stock(), 318 309 'stock_status' => (string) $product->get_stock_status(), 310 'stock_quantity' => $product->get_stock_quantity() !== null ? (int) $product->get_stock_quantity() : null, 311 'is_in_stock' => (bool) $product->is_in_stock(), 319 312 // Variation Details 320 'variation_id' => (int) $variation_id,321 'variation_attributes' => $variation_attributes313 'variation_id' => (int) $variation_id, 314 'variation_attributes'=> $variation_attributes 322 315 )); 323 316 324 $event_attributes = array( 325 ...$items[0], 326 'cart_total' => (float) WC()->cart->get_cart_contents_total(), 327 'cart_subtotal' => (float) WC()->cart->get_subtotal(), 328 'cart_tax' => (float) WC()->cart->get_cart_tax(), 329 'cart_items_count' => (int) WC()->cart->get_cart_contents_count(), 317 $event_attributes = array_merge($items[0], array( 318 'cart_total' => (float) WC()->cart->get_cart_contents_total(), 319 'cart_subtotal' => (float) WC()->cart->get_subtotal(), 320 'cart_tax' => (float) WC()->cart->get_cart_tax(), 321 'cart_items_count' => (int) WC()->cart->get_cart_contents_count(), 330 322 'cart_unique_items' => (int) count(WC()->cart->get_cart()), 331 'applied_coupons' => array_map('strval', WC()->cart->get_applied_coupons()), 332 323 'applied_coupons' => array_map('strval', WC()->cart->get_applied_coupons()), 333 324 // Items Array 334 'items' => $items, 335 325 'items' => $items, 336 326 // Additional Context 337 'added_from' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),338 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'),339 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')340 ) ;327 'added_from' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 328 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'), 329 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') 330 )); 341 331 342 332 $this->send_event('added_to_cart', $event_attributes); … … 375 365 // Get line totals and ensure they're properly typed 376 366 $line_total = !empty($cart_item['line_total']) ? (float) $cart_item['line_total'] : 0.0; 377 $line_tax = !empty($cart_item['line_tax']) ? (float) $cart_item['line_tax'] : 0.0;367 $line_tax = !empty($cart_item['line_tax']) ? (float) $cart_item['line_tax'] : 0.0; 378 368 $price_per_unit = $product->get_price(); 379 369 $price_per_unit = $price_per_unit === '' ? 0.0 : (float) $price_per_unit; … … 381 371 // Create items array with single product 382 372 $items = array(array( 383 'product_id' => (int) $product_id, 384 'product_name' => (string) $product->get_name(), 385 'product_sku' => (string) $product->get_sku(), 386 'product_type' => (string) $product->get_type(), 387 'categories' => array_map('strval', $categories), 388 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 389 373 'product_id' => (int) $product_id, 374 'product_name' => (string) $product->get_name(), 375 'product_sku' => (string) $product->get_sku(), 376 'product_type' => (string) $product->get_type(), 377 'categories' => array_map('strval', $categories), 378 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 390 379 // Removed Item Details 391 'quantity_removed' => (int) $cart_item['quantity'], 392 'line_total' => $line_total, 393 'line_tax' => $line_tax, 394 'price_per_unit' => $price_per_unit, 395 'currency' => (string) get_woocommerce_currency(), 396 380 'quantity_removed' => (int) $cart_item['quantity'], 381 'line_total' => $line_total, 382 'line_tax' => $line_tax, 383 'price_per_unit' => $price_per_unit, 384 'currency' => (string) get_woocommerce_currency(), 397 385 // Variation Details 398 'variation_id' => !empty($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : 0,399 'variation_attributes' => $variation_attributes386 'variation_id' => !empty($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : 0, 387 'variation_attributes'=> $variation_attributes 400 388 )); 401 389 402 $event_attributes = array( 403 ...$items[0], 404 'cart_total' => (float) $cart->get_cart_contents_total(), 405 'cart_subtotal' => (float) $cart->get_subtotal(), 406 'cart_tax' => (float) $cart->get_cart_tax(), 407 'remaining_items' => (int) $cart->get_cart_contents_count(), 390 $event_attributes = array_merge($items[0], array( 391 'cart_total' => (float) $cart->get_cart_contents_total(), 392 'cart_subtotal' => (float) $cart->get_subtotal(), 393 'cart_tax' => (float) $cart->get_cart_tax(), 394 'remaining_items' => (int) $cart->get_cart_contents_count(), 408 395 'remaining_unique_items' => (int) count($cart->get_cart()), 409 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 410 396 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 411 397 // Items Array 412 'items' => $items, 413 398 'items' => $items, 414 399 // Additional Context 415 'removed_from_page' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),416 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'),417 'session_id' => (string) WC()->session->get_customer_id(),418 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')419 ) ;400 'removed_from_page' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 401 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'), 402 'session_id' => (string) WC()->session->get_customer_id(), 403 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') 404 )); 420 405 421 406 $this->send_event('removed_from_cart', $event_attributes); … … 461 446 $items = array(array( 462 447 // Product Information 463 'product_id' => (int) $product_id, 464 'product_name' => (string) $product->get_name(), 465 'product_type' => (string) $product->get_type(), 466 'categories' => array_map('strval', $categories), 467 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 468 448 'product_id' => (int) $product_id, 449 'product_name' => (string) $product->get_name(), 450 'product_type' => (string) $product->get_type(), 451 'categories' => array_map('strval', $categories), 452 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 469 453 // Quantity Change Details 470 'old_quantity' => (int) $old_quantity, 471 'new_quantity' => (int) $quantity, 472 'quantity_change' => (int) ($quantity - $old_quantity), 473 'price' => (float) $unit_price, 474 'old_line_total' => (float) $old_line_total, 475 'new_line_total' => (float) $new_line_total, 476 'currency' => (string) get_woocommerce_currency(), 477 454 'old_quantity' => (int) $old_quantity, 455 'new_quantity' => (int) $quantity, 456 'quantity_change' => (int) ($quantity - $old_quantity), 457 'price' => (float) $unit_price, 458 'old_line_total' => (float) $old_line_total, 459 'new_line_total' => (float) $new_line_total, 460 'currency' => (string) get_woocommerce_currency(), 478 461 // Stock Information 479 'stock_status' => (string) $product->get_stock_status(), 480 'remaining_stock' => $product->get_stock_quantity() !== null ? 481 (int) $product->get_stock_quantity() : 482 null, 483 462 'stock_status' => (string) $product->get_stock_status(), 463 'remaining_stock' => $product->get_stock_quantity() !== null ? (int) $product->get_stock_quantity() : null, 484 464 // Variation Details 485 'variation_id' => (int) ($cart_item['variation_id'] ?? 0),486 'variation_attributes' => $variation_attributes465 'variation_id' => (int) ($cart_item['variation_id'] ?? 0), 466 'variation_attributes'=> $variation_attributes 487 467 )); 488 468 489 $event_attributes = array( 490 ...$items[0], 491 469 $event_attributes = array_merge($items[0], array( 492 470 // Items Array 493 471 'items' => $items, 494 495 472 // Cart State 496 'cart_total' => (float) $cart->get_total('numeric'),497 'cart_subtotal' => (float) $cart->get_subtotal(),498 'cart_tax' => (float) $cart->get_cart_tax(),499 'cart_items_count' => (int) $cart->get_cart_contents_count(),473 'cart_total' => (float) $cart->get_total('numeric'), 474 'cart_subtotal' => (float) $cart->get_subtotal(), 475 'cart_tax' => (float) $cart->get_cart_tax(), 476 'cart_items_count' => (int) $cart->get_cart_contents_count(), 500 477 'cart_unique_items' => (int) count($cart->get_cart()), 501 'cart_discount' => (float) $cart->get_discount_total(), 502 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 503 478 'cart_discount' => (float) $cart->get_discount_total(), 479 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 504 480 // Additional Context 505 'update_source' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),506 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'),507 'timestamp' => current_time('mysql'),508 'session_id' => (string) WC()->session->get_customer_id(),509 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')510 ) ;481 'update_source' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 482 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'), 483 'timestamp' => current_time('mysql'), 484 'session_id' => (string) WC()->session->get_customer_id(), 485 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') 486 )); 511 487 512 488 $this->send_event('updated_cart_item', $event_attributes); … … 612 588 613 589 $items[] = array( 614 'product_id' => (int) $parent_product->get_id(),615 'product_name' => (string) $parent_product->get_name(),616 'product_sku' => (string) $product->get_sku(),617 'quantity' => (int) $cart_item['quantity'],618 'unit_price' => $unit_price,619 'line_total' => (float) $cart_item['line_total'],620 'line_tax' => (float) $cart_item['line_tax'],621 'categories' => array_map('strval', $categories),622 'variation_id' => isset($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : null,623 'variation_attributes' => $variation_attributes,624 'is_on_sale' => (bool) $product->is_on_sale(),625 'stock_status' => (string) $product->get_stock_status()590 'product_id' => (int) $parent_product->get_id(), 591 'product_name' => (string) $parent_product->get_name(), 592 'product_sku' => (string) $product->get_sku(), 593 'quantity' => (int) $cart_item['quantity'], 594 'unit_price' => $unit_price, 595 'line_total' => (float) $cart_item['line_total'], 596 'line_tax' => (float) $cart_item['line_tax'], 597 'categories' => array_map('strval', $categories), 598 'variation_id' => isset($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : null, 599 'variation_attributes'=> $variation_attributes, 600 'is_on_sale' => (bool) $product->is_on_sale(), 601 'stock_status' => (string) $product->get_stock_status() 626 602 ); 627 603 } … … 675 651 ); 676 652 677 // Send the event678 653 $this->send_event('initiated_checkout', $event_attributes); 679 654 … … 920 895 921 896 $item_data = array( 922 'product_id' => (int) $parent_product->get_id(),923 'product_name' => (string) $parent_product->get_name(),924 'quantity' => (int) ($is_refund ? abs($item->get_quantity()) : $item->get_quantity()),925 'price' => (float) $product->get_price(),926 'subtotal' => (float) ($is_refund ? abs($item->get_subtotal()) : $item->get_subtotal()),927 'total' => (float) ($is_refund ? abs($item->get_total()) : $item->get_total()),928 'sku' => (string) $product->get_sku(),929 'categories' => array_map('strval', $categories),930 'variation_id' => $variation_id ? (int) $variation_id : null,931 'variation_attributes' => $variation_attributes,932 'tax' => (float) ($is_refund ? abs($item->get_total_tax()) : $item->get_total_tax())897 'product_id' => (int) $parent_product->get_id(), 898 'product_name' => (string) $parent_product->get_name(), 899 'quantity' => (int) ($is_refund ? abs($item->get_quantity()) : $item->get_quantity()), 900 'price' => (float) $product->get_price(), 901 'subtotal' => (float) ($is_refund ? abs($item->get_subtotal()) : $item->get_subtotal()), 902 'total' => (float) ($is_refund ? abs($item->get_total()) : $item->get_total()), 903 'sku' => (string) $product->get_sku(), 904 'categories' => array_map('strval', $categories), 905 'variation_id' => $variation_id ? (int) $variation_id : null, 906 'variation_attributes'=> $variation_attributes, 907 'tax' => (float) ($is_refund ? abs($item->get_total_tax()) : $item->get_total_tax()) 933 908 ); 934 909 … … 1866 1841 )); 1867 1842 1868 $event_attributes = array( 1869 ...$items[0], 1843 $event_attributes = array_merge($items[0], array( 1870 1844 'items' => $items, 1871 1845 'wishlist_id' => (int) $wishlist_id, … … 1873 1847 'user_id' => (int) $user_id, 1874 1848 'total_items_in_wishlist' => (int) YITH_WCWL()->count_products($wishlist_id) 1875 ) ;1849 )); 1876 1850 1877 1851 $this->send_event('added_to_wishlist', $event_attributes); … … 1906 1880 )); 1907 1881 1908 $event_attributes = array( 1909 ...$items[0], 1882 $event_attributes = array_merge($items[0], array( 1910 1883 'items' => $items, 1911 1884 'wishlist_id' => (int) $wishlist_id, … … 1914 1887 'user_id' => (int) $user_id, 1915 1888 'remaining_items_in_wishlist' => (int) YITH_WCWL()->count_products($wishlist_id) 1916 ) ;1889 )); 1917 1890 1918 1891 $this->send_event('removed_from_wishlist', $event_attributes); … … 1949 1922 )); 1950 1923 1951 $event_attributes = array( 1952 ...$items[0], 1924 $event_attributes = array_merge($items[0], array( 1953 1925 'items' => $items, 1954 1926 'from_wishlist_id' => (int) $wishlist_from_id, … … 1959 1931 'items_in_source_wishlist' => (int) YITH_WCWL()->count_products($wishlist_from_id), 1960 1932 'items_in_destination_wishlist' => (int) YITH_WCWL()->count_products($wishlist_to_id) 1961 ) ;1933 )); 1962 1934 1963 1935 $this->send_event('moved_wishlist_item', $event_attributes); -
usermaven/tags/1.1.8/includes/class-usermaven.php
r3258904 r3258914 81 81 $this->version = USERMAVEN_VERSION; 82 82 } else { 83 $this->version = '1.1. 7';83 $this->version = '1.1.8'; 84 84 } 85 85 $this->plugin_name = 'usermaven'; -
usermaven/tags/1.1.8/usermaven.php
r3241679 r3258914 19 19 * Description: The Easiest Website and Product Analytics Platform 20 20 21 * Version: 1.1. 621 * Version: 1.1.8 22 22 * Author: Usermaven 23 23 * Author URI: https://usermaven.com/ … … 38 38 * Rename this for your plugin and update it as you release new versions. 39 39 */ 40 define( 'USERMAVEN_VERSION', '1.1. 6' );40 define( 'USERMAVEN_VERSION', '1.1.8' ); 41 41 42 42 /** -
usermaven/trunk/README.txt
r3241679 r3258914 6 6 Tested up to: 6.7.1 7 7 Requires PHP: 5.6 8 Stable tag: 1.1. 68 Stable tag: 1.1.8 9 9 License: Massachusetts Institute of Technology (MIT) license 10 10 License URI: https://opensource.org/licenses/MIT -
usermaven/trunk/includes/class-usermaven-woocommerce.php
r3241679 r3258914 235 235 // Create items array with single product 236 236 $items = array(array( 237 'product_id' => (int) $product->get_id(),237 'product_id' => (int) $product->get_id(), 238 238 'product_name' => (string) $product->get_name(), 239 'price' => (float) $product->get_price(),240 'currency' => (string) get_woocommerce_currency(),241 'type' => (string) $product->get_type(),242 'categories' => array_map('strval', $categories),243 'sku' => (string) $product->get_sku(),239 'price' => (float) $product->get_price(), 240 'currency' => (string) get_woocommerce_currency(), 241 'type' => (string) $product->get_type(), 242 'categories' => array_map('strval', $categories), 243 'sku' => (string) $product->get_sku(), 244 244 'stock_status' => (string) $product->get_stock_status() 245 245 )); 246 246 247 $event_attributes = array( 248 ...$items[0], 249 247 $event_attributes = array_merge($items[0], array( 250 248 // Items Array 251 249 'items' => $items, 252 ) ;250 )); 253 251 254 252 // Send the event … … 294 292 $items = array(array( 295 293 // Product Information 296 'product_id' => (int) $product_id, 297 'product_name' => (string) $product->get_name(), 298 'product_sku' => (string) $product->get_sku(), 299 'product_type' => (string) $product->get_type(), 300 'categories' => array_map('strval', $categories), 301 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 302 294 'product_id' => (int) $product_id, 295 'product_name' => (string) $product->get_name(), 296 'product_sku' => (string) $product->get_sku(), 297 'product_type' => (string) $product->get_type(), 298 'categories' => array_map('strval', $categories), 299 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 303 300 // Quantity and Price Details 304 'quantity' => (int) $quantity, 305 'unit_price' => $unit_price, 306 'regular_price' => (float) $product->get_regular_price(), 307 'sale_price' => (float) $product->get_sale_price(), 308 'price_total' => $price_total, 309 'is_on_sale' => (bool) $product->is_on_sale(), 310 'currency' => (string) get_woocommerce_currency(), 311 301 'quantity' => (int) $quantity, 302 'unit_price' => $unit_price, 303 'regular_price' => (float) $product->get_regular_price(), 304 'sale_price' => (float) $product->get_sale_price(), 305 'price_total' => $price_total, 306 'is_on_sale' => (bool) $product->is_on_sale(), 307 'currency' => (string) get_woocommerce_currency(), 312 308 // Stock Information 313 'stock_status' => (string) $product->get_stock_status(), 314 'stock_quantity' => $product->get_stock_quantity() !== null ? 315 (int) $product->get_stock_quantity() : 316 null, 317 'is_in_stock' => (bool) $product->is_in_stock(), 318 309 'stock_status' => (string) $product->get_stock_status(), 310 'stock_quantity' => $product->get_stock_quantity() !== null ? (int) $product->get_stock_quantity() : null, 311 'is_in_stock' => (bool) $product->is_in_stock(), 319 312 // Variation Details 320 'variation_id' => (int) $variation_id,321 'variation_attributes' => $variation_attributes313 'variation_id' => (int) $variation_id, 314 'variation_attributes'=> $variation_attributes 322 315 )); 323 316 324 $event_attributes = array( 325 ...$items[0], 326 'cart_total' => (float) WC()->cart->get_cart_contents_total(), 327 'cart_subtotal' => (float) WC()->cart->get_subtotal(), 328 'cart_tax' => (float) WC()->cart->get_cart_tax(), 329 'cart_items_count' => (int) WC()->cart->get_cart_contents_count(), 317 $event_attributes = array_merge($items[0], array( 318 'cart_total' => (float) WC()->cart->get_cart_contents_total(), 319 'cart_subtotal' => (float) WC()->cart->get_subtotal(), 320 'cart_tax' => (float) WC()->cart->get_cart_tax(), 321 'cart_items_count' => (int) WC()->cart->get_cart_contents_count(), 330 322 'cart_unique_items' => (int) count(WC()->cart->get_cart()), 331 'applied_coupons' => array_map('strval', WC()->cart->get_applied_coupons()), 332 323 'applied_coupons' => array_map('strval', WC()->cart->get_applied_coupons()), 333 324 // Items Array 334 'items' => $items, 335 325 'items' => $items, 336 326 // Additional Context 337 'added_from' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),338 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'),339 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')340 ) ;327 'added_from' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 328 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'), 329 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') 330 )); 341 331 342 332 $this->send_event('added_to_cart', $event_attributes); … … 375 365 // Get line totals and ensure they're properly typed 376 366 $line_total = !empty($cart_item['line_total']) ? (float) $cart_item['line_total'] : 0.0; 377 $line_tax = !empty($cart_item['line_tax']) ? (float) $cart_item['line_tax'] : 0.0;367 $line_tax = !empty($cart_item['line_tax']) ? (float) $cart_item['line_tax'] : 0.0; 378 368 $price_per_unit = $product->get_price(); 379 369 $price_per_unit = $price_per_unit === '' ? 0.0 : (float) $price_per_unit; … … 381 371 // Create items array with single product 382 372 $items = array(array( 383 'product_id' => (int) $product_id, 384 'product_name' => (string) $product->get_name(), 385 'product_sku' => (string) $product->get_sku(), 386 'product_type' => (string) $product->get_type(), 387 'categories' => array_map('strval', $categories), 388 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 389 373 'product_id' => (int) $product_id, 374 'product_name' => (string) $product->get_name(), 375 'product_sku' => (string) $product->get_sku(), 376 'product_type' => (string) $product->get_type(), 377 'categories' => array_map('strval', $categories), 378 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 390 379 // Removed Item Details 391 'quantity_removed' => (int) $cart_item['quantity'], 392 'line_total' => $line_total, 393 'line_tax' => $line_tax, 394 'price_per_unit' => $price_per_unit, 395 'currency' => (string) get_woocommerce_currency(), 396 380 'quantity_removed' => (int) $cart_item['quantity'], 381 'line_total' => $line_total, 382 'line_tax' => $line_tax, 383 'price_per_unit' => $price_per_unit, 384 'currency' => (string) get_woocommerce_currency(), 397 385 // Variation Details 398 'variation_id' => !empty($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : 0,399 'variation_attributes' => $variation_attributes386 'variation_id' => !empty($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : 0, 387 'variation_attributes'=> $variation_attributes 400 388 )); 401 389 402 $event_attributes = array( 403 ...$items[0], 404 'cart_total' => (float) $cart->get_cart_contents_total(), 405 'cart_subtotal' => (float) $cart->get_subtotal(), 406 'cart_tax' => (float) $cart->get_cart_tax(), 407 'remaining_items' => (int) $cart->get_cart_contents_count(), 390 $event_attributes = array_merge($items[0], array( 391 'cart_total' => (float) $cart->get_cart_contents_total(), 392 'cart_subtotal' => (float) $cart->get_subtotal(), 393 'cart_tax' => (float) $cart->get_cart_tax(), 394 'remaining_items' => (int) $cart->get_cart_contents_count(), 408 395 'remaining_unique_items' => (int) count($cart->get_cart()), 409 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 410 396 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 411 397 // Items Array 412 'items' => $items, 413 398 'items' => $items, 414 399 // Additional Context 415 'removed_from_page' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),416 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'),417 'session_id' => (string) WC()->session->get_customer_id(),418 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')419 ) ;400 'removed_from_page' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 401 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'), 402 'session_id' => (string) WC()->session->get_customer_id(), 403 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') 404 )); 420 405 421 406 $this->send_event('removed_from_cart', $event_attributes); … … 461 446 $items = array(array( 462 447 // Product Information 463 'product_id' => (int) $product_id, 464 'product_name' => (string) $product->get_name(), 465 'product_type' => (string) $product->get_type(), 466 'categories' => array_map('strval', $categories), 467 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 468 448 'product_id' => (int) $product_id, 449 'product_name' => (string) $product->get_name(), 450 'product_type' => (string) $product->get_type(), 451 'categories' => array_map('strval', $categories), 452 'tags' => array_map('strval', wp_get_post_terms($product_id, 'product_tag', array('fields' => 'names'))), 469 453 // Quantity Change Details 470 'old_quantity' => (int) $old_quantity, 471 'new_quantity' => (int) $quantity, 472 'quantity_change' => (int) ($quantity - $old_quantity), 473 'price' => (float) $unit_price, 474 'old_line_total' => (float) $old_line_total, 475 'new_line_total' => (float) $new_line_total, 476 'currency' => (string) get_woocommerce_currency(), 477 454 'old_quantity' => (int) $old_quantity, 455 'new_quantity' => (int) $quantity, 456 'quantity_change' => (int) ($quantity - $old_quantity), 457 'price' => (float) $unit_price, 458 'old_line_total' => (float) $old_line_total, 459 'new_line_total' => (float) $new_line_total, 460 'currency' => (string) get_woocommerce_currency(), 478 461 // Stock Information 479 'stock_status' => (string) $product->get_stock_status(), 480 'remaining_stock' => $product->get_stock_quantity() !== null ? 481 (int) $product->get_stock_quantity() : 482 null, 483 462 'stock_status' => (string) $product->get_stock_status(), 463 'remaining_stock' => $product->get_stock_quantity() !== null ? (int) $product->get_stock_quantity() : null, 484 464 // Variation Details 485 'variation_id' => (int) ($cart_item['variation_id'] ?? 0),486 'variation_attributes' => $variation_attributes465 'variation_id' => (int) ($cart_item['variation_id'] ?? 0), 466 'variation_attributes'=> $variation_attributes 487 467 )); 488 468 489 $event_attributes = array( 490 ...$items[0], 491 469 $event_attributes = array_merge($items[0], array( 492 470 // Items Array 493 471 'items' => $items, 494 495 472 // Cart State 496 'cart_total' => (float) $cart->get_total('numeric'),497 'cart_subtotal' => (float) $cart->get_subtotal(),498 'cart_tax' => (float) $cart->get_cart_tax(),499 'cart_items_count' => (int) $cart->get_cart_contents_count(),473 'cart_total' => (float) $cart->get_total('numeric'), 474 'cart_subtotal' => (float) $cart->get_subtotal(), 475 'cart_tax' => (float) $cart->get_cart_tax(), 476 'cart_items_count' => (int) $cart->get_cart_contents_count(), 500 477 'cart_unique_items' => (int) count($cart->get_cart()), 501 'cart_discount' => (float) $cart->get_discount_total(), 502 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 503 478 'cart_discount' => (float) $cart->get_discount_total(), 479 'applied_coupons' => array_map('strval', $cart->get_applied_coupons()), 504 480 // Additional Context 505 'update_source' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''),506 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'),507 'timestamp' => current_time('mysql'),508 'session_id' => (string) WC()->session->get_customer_id(),509 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '')510 ) ;481 'update_source' => (string) (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 482 'device_type' => (string) (wp_is_mobile() ? 'mobile' : 'desktop'), 483 'timestamp' => current_time('mysql'), 484 'session_id' => (string) WC()->session->get_customer_id(), 485 'user_agent' => (string) (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '') 486 )); 511 487 512 488 $this->send_event('updated_cart_item', $event_attributes); … … 612 588 613 589 $items[] = array( 614 'product_id' => (int) $parent_product->get_id(),615 'product_name' => (string) $parent_product->get_name(),616 'product_sku' => (string) $product->get_sku(),617 'quantity' => (int) $cart_item['quantity'],618 'unit_price' => $unit_price,619 'line_total' => (float) $cart_item['line_total'],620 'line_tax' => (float) $cart_item['line_tax'],621 'categories' => array_map('strval', $categories),622 'variation_id' => isset($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : null,623 'variation_attributes' => $variation_attributes,624 'is_on_sale' => (bool) $product->is_on_sale(),625 'stock_status' => (string) $product->get_stock_status()590 'product_id' => (int) $parent_product->get_id(), 591 'product_name' => (string) $parent_product->get_name(), 592 'product_sku' => (string) $product->get_sku(), 593 'quantity' => (int) $cart_item['quantity'], 594 'unit_price' => $unit_price, 595 'line_total' => (float) $cart_item['line_total'], 596 'line_tax' => (float) $cart_item['line_tax'], 597 'categories' => array_map('strval', $categories), 598 'variation_id' => isset($cart_item['variation_id']) ? (int) $cart_item['variation_id'] : null, 599 'variation_attributes'=> $variation_attributes, 600 'is_on_sale' => (bool) $product->is_on_sale(), 601 'stock_status' => (string) $product->get_stock_status() 626 602 ); 627 603 } … … 675 651 ); 676 652 677 // Send the event678 653 $this->send_event('initiated_checkout', $event_attributes); 679 654 … … 920 895 921 896 $item_data = array( 922 'product_id' => (int) $parent_product->get_id(),923 'product_name' => (string) $parent_product->get_name(),924 'quantity' => (int) ($is_refund ? abs($item->get_quantity()) : $item->get_quantity()),925 'price' => (float) $product->get_price(),926 'subtotal' => (float) ($is_refund ? abs($item->get_subtotal()) : $item->get_subtotal()),927 'total' => (float) ($is_refund ? abs($item->get_total()) : $item->get_total()),928 'sku' => (string) $product->get_sku(),929 'categories' => array_map('strval', $categories),930 'variation_id' => $variation_id ? (int) $variation_id : null,931 'variation_attributes' => $variation_attributes,932 'tax' => (float) ($is_refund ? abs($item->get_total_tax()) : $item->get_total_tax())897 'product_id' => (int) $parent_product->get_id(), 898 'product_name' => (string) $parent_product->get_name(), 899 'quantity' => (int) ($is_refund ? abs($item->get_quantity()) : $item->get_quantity()), 900 'price' => (float) $product->get_price(), 901 'subtotal' => (float) ($is_refund ? abs($item->get_subtotal()) : $item->get_subtotal()), 902 'total' => (float) ($is_refund ? abs($item->get_total()) : $item->get_total()), 903 'sku' => (string) $product->get_sku(), 904 'categories' => array_map('strval', $categories), 905 'variation_id' => $variation_id ? (int) $variation_id : null, 906 'variation_attributes'=> $variation_attributes, 907 'tax' => (float) ($is_refund ? abs($item->get_total_tax()) : $item->get_total_tax()) 933 908 ); 934 909 … … 1866 1841 )); 1867 1842 1868 $event_attributes = array( 1869 ...$items[0], 1843 $event_attributes = array_merge($items[0], array( 1870 1844 'items' => $items, 1871 1845 'wishlist_id' => (int) $wishlist_id, … … 1873 1847 'user_id' => (int) $user_id, 1874 1848 'total_items_in_wishlist' => (int) YITH_WCWL()->count_products($wishlist_id) 1875 ) ;1849 )); 1876 1850 1877 1851 $this->send_event('added_to_wishlist', $event_attributes); … … 1906 1880 )); 1907 1881 1908 $event_attributes = array( 1909 ...$items[0], 1882 $event_attributes = array_merge($items[0], array( 1910 1883 'items' => $items, 1911 1884 'wishlist_id' => (int) $wishlist_id, … … 1914 1887 'user_id' => (int) $user_id, 1915 1888 'remaining_items_in_wishlist' => (int) YITH_WCWL()->count_products($wishlist_id) 1916 ) ;1889 )); 1917 1890 1918 1891 $this->send_event('removed_from_wishlist', $event_attributes); … … 1949 1922 )); 1950 1923 1951 $event_attributes = array( 1952 ...$items[0], 1924 $event_attributes = array_merge($items[0], array( 1953 1925 'items' => $items, 1954 1926 'from_wishlist_id' => (int) $wishlist_from_id, … … 1959 1931 'items_in_source_wishlist' => (int) YITH_WCWL()->count_products($wishlist_from_id), 1960 1932 'items_in_destination_wishlist' => (int) YITH_WCWL()->count_products($wishlist_to_id) 1961 ) ;1933 )); 1962 1934 1963 1935 $this->send_event('moved_wishlist_item', $event_attributes); -
usermaven/trunk/includes/class-usermaven.php
r3258904 r3258914 81 81 $this->version = USERMAVEN_VERSION; 82 82 } else { 83 $this->version = '1.1. 7';83 $this->version = '1.1.8'; 84 84 } 85 85 $this->plugin_name = 'usermaven'; -
usermaven/trunk/usermaven.php
r3241679 r3258914 19 19 * Description: The Easiest Website and Product Analytics Platform 20 20 21 * Version: 1.1. 621 * Version: 1.1.8 22 22 * Author: Usermaven 23 23 * Author URI: https://usermaven.com/ … … 38 38 * Rename this for your plugin and update it as you release new versions. 39 39 */ 40 define( 'USERMAVEN_VERSION', '1.1. 6' );40 define( 'USERMAVEN_VERSION', '1.1.8' ); 41 41 42 42 /**
Note: See TracChangeset
for help on using the changeset viewer.