Changeset 2148364
- Timestamp:
- 08/30/2019 10:52:15 AM (7 years ago)
- Location:
- activechat-ai/trunk
- Files:
-
- 3 edited
-
include/track.php (modified) (3 diffs)
-
index.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
activechat-ai/trunk/include/track.php
r2147319 r2148364 8 8 ?> 9 9 <script> 10 "use strict"; 11 window.addEventListener("load", function() { 10 (function() { 12 11 var script = document.createElement('script'); 13 12 script.src = 'https://app.activechat.ai/script/<?php esc_attr_e($bot_id); ?>'; 14 13 script.id = 'ACCW_EMBED'; 15 14 script.onload = () => { 16 try{17 loadedACCWScript();18 } catch{}19 }15 try { 16 loadedACCWScript(); 17 } catch {} 18 } 20 19 document.getElementsByTagName('head')[0].appendChild(script); 21 } , false);20 })(); 22 21 </script> 23 <?php22 <?php 24 23 25 }24 } 26 25 27 function AdminAcVV_add_action_woocommerce_add_to_cart($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data)28 {29 if (!empty($_POST) && sanitize_text_field(get_option('woocommerce_cart_redirect_after_add')) == 'no') {30 ?>26 function AdminAcVV_add_action_woocommerce_add_to_cart($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data) 27 { 28 if (!empty($_POST) && sanitize_text_field(get_option('woocommerce_cart_redirect_after_add')) == 'no') { 29 ?> 31 30 <script> 32 function loadedACCWScript() {33 document.querySelector('#AC_TRACK').addEventListener('load', function() {34 activechat.track('add_to_cart', {31 function loadedACCWScript() { 32 document.querySelector('#AC_TRACK').addEventListener('load', function() { 33 activechat.track('add_to_cart', { 35 34 _woo_cart_cart_item_key: '<?php esc_attr_e($cart_item_key); ?>', 36 35 _woo_cart_product_id: '<?php esc_attr_e($product_id); ?>', … … 39 38 _woo_cart_variation: '<?php esc_attr_e($variation); ?>', 40 39 _woo_cart_cart_item_data: '<?php esc_attr_e($cart_item_data); ?>', 41 });42 40 }); 43 } 41 }); 42 } 44 43 </script> 45 <?php46 }47 }48 add_action('woocommerce_add_to_cart', 'AdminAcVV_add_action_woocommerce_add_to_cart', 10, 6);44 <?php 45 } 46 } 47 add_action('woocommerce_add_to_cart', 'AdminAcVV_add_action_woocommerce_add_to_cart', 10, 6); 49 48 50 49 51 function accw_add_action_woocommerce_new_order()52 {53 if (class_exists('WooCommerce')) {54 if (is_order_received_page() == 1) {55 global $wp;56 $order_id = $wp->query_vars['order-received'];57 $customer_id = get_post_meta($order_id, '_customer_user', true);58 $agent_id = sanitize_key(get_option('acvv_save_bot_id'));59 $user_id = '12'60 ?>50 function accw_add_action_woocommerce_new_order() 51 { 52 if (class_exists('WooCommerce')) { 53 if (is_order_received_page() == 1) { 54 global $wp; 55 $order_id = $wp->query_vars['order-received']; 56 $customer_id = get_post_meta($order_id, '_customer_user', true); 57 $agent_id = sanitize_key(get_option('acvv_save_bot_id')); 58 $user_id = '12' 59 ?> 61 60 <script> 62 63 64 function loadedACCWScript() { 61 function loadedACCWScript() { 65 62 document.querySelector('#AC_TRACK').addEventListener('load', function() { 66 activechat.track('order_create', {67 _woo_order_id: '<?php esc_attr_e($order_id); ?>'68 });69 });63 activechat.track('order_create', { 64 _woo_order_id: '<?php esc_attr_e($order_id); ?>' 65 }); 66 }); 70 67 71 68 … … 155 152 }; 156 153 </script> 157 <?php 154 <?php 155 } 158 156 } 159 } 160 }; 157 }; 161 158 162 159 163 add_action('wp_footer', 'accw_add_action_woocommerce_new_order');160 add_action('wp_footer', 'accw_add_action_woocommerce_new_order'); 164 161 165 162 166 function accw_add_action_woocommerce_add_to_cart_ajax()167 {168 ?>163 function accw_add_action_woocommerce_add_to_cart_ajax() 164 { 165 ?> 169 166 <script> 170 167 window.addEventListener('load', function() { -
activechat-ai/trunk/index.php
r2147310 r2148364 4 4 Plugin URI: https://activechat.ai/manuals/e-commerce-chatbots/wordpress-plugin/ 5 5 Description: Activechat.ai - smart multichannel chatbots and live chat - is a free plugin for WordPress which allows users to easily integrate their Activechat bots to any WordPress website with zero bot training or code knowledge required. Pure plug’n’play experience. 6 Version: 1.0. 96 Version: 1.0.10 7 7 Author: ActiveChat 8 8 Author URI: https://activechat.ai/ -
activechat-ai/trunk/readme.txt
r2147310 r2148364 121 121 = 1.0.9 = 122 122 Fixed bug with "add_to_cart" event 123 = 1.0.10 = 124 Delay before loading scripts was deleted 123 125 124 126 == Upgrade Notice == 125 = 1.0. 9=126 Fixed bug with "add_to_cart" event 127 = 1.0.10 = 128 Delay before loading scripts was deleted 127 129 128 130
Note: See TracChangeset
for help on using the changeset viewer.