|
@@ 123-136 (lines=14) @@
|
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
// this is when added from product page post request |
| 123 |
|
public function capture_add_to_cart_from_product_page() { |
| 124 |
|
$cart = WC()->cart->get_cart(); |
| 125 |
|
wc_enqueue_js( " |
| 126 |
|
jQuery( function( $ ) { |
| 127 |
|
_sta.push( { |
| 128 |
|
_en: 'woocommerce_analytics_add_to_cart', |
| 129 |
|
blog_id: " . $blogid . ", |
| 130 |
|
cart_id: " . $this->get_session_id() . ", |
| 131 |
|
cart_products: " . array_reduce( $cart, array( $this, 'get_cart_ids' ), '' ) . ", |
| 132 |
|
cart_quantities: " . array_reduce( $cart, array( $this, 'get_cart_quantities' ), '' ) . " |
| 133 |
|
} ); |
| 134 |
|
} ); |
| 135 |
|
" ); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
public function handle_purchase_event() { |
| 139 |
|
$cart = WC()->cart->get_cart(); |
|
@@ 138-151 (lines=14) @@
|
| 135 |
|
" ); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
public function handle_purchase_event() { |
| 139 |
|
$cart = WC()->cart->get_cart(); |
| 140 |
|
// this one not working yet |
| 141 |
|
wc_enqueue_js( " |
| 142 |
|
window._sta = window._sta || []; |
| 143 |
|
_sta.push( { |
| 144 |
|
_en: 'woocommerce_analytics_purchase', |
| 145 |
|
blog_id: " . Jetpack::get_option( 'id' ) . ", |
| 146 |
|
cart_id: '" . $this->get_session_id() . "', |
| 147 |
|
cart_products: " . array_reduce( $cart, array( $this, 'get_cart_ids' ), '' ) . ", |
| 148 |
|
cart_quantities: " . array_reduce( $cart, array( $this, 'get_cart_quantities' ), '' ) . " |
| 149 |
|
} ); |
| 150 |
|
" ); |
| 151 |
|
} |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
WC_Stats::init(); |