Plugin Directory

Changeset 3452830


Ignore:
Timestamp:
02/03/2026 11:59:06 AM (8 weeks ago)
Author:
fastwpde
Message:

Changelog

1.4.0

  • Internal refactoring to improve performance and maintainability
  • Improved frontend tracking script handling
  • Optimized WooCommerce event tracking
  • Improved admin structure and asset loading
  • Codebase prepared for future extensions
Location:
trackboxx-analytics/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trackboxx-analytics/trunk/includes/class-trackboxx.php

    r3404142 r3452830  
    187187        // WooCommerce tracking hooks
    188188        $this->loader->add_action( 'woocommerce_before_thankyou', $plugin_public, 'wc_purchase_tracking_script' );
    189         $this->loader->add_action( 'woocommerce_add_to_cart', $plugin_public, 'wc_add_to_cart', 10, 2 );
     189        // $this->loader->add_action( 'woocommerce_add_to_cart', $plugin_public, 'wc_add_to_cart', 10, 2 );
    190190       
    191191        // New View Cart tracking hooks (added in version 1.3.34)
    192192        $this->loader->add_action( 'wp_footer', $plugin_public, 'wc_view_cart_tracking' );
    193193        $this->loader->add_action( 'wp_footer', $plugin_public, 'wc_view_product_tracking' );
     194        $this->loader->add_filter( 'woocommerce_loop_add_to_cart_args', $plugin_public, 'wc_add_to_cart_args', 10, 2 );
     195        $this->loader->add_action( 'woocommerce_after_add_to_cart_button', $plugin_public, 'wc_after_add_to_cart_button' );
    194196    }
    195197
  • trackboxx-analytics/trunk/public/class-trackboxx-public.php

    r3404142 r3452830  
    114114        // enqueue_scripts_old are fired on the same request.
    115115        $this->tb_output_loader( $trackboxx_id );
     116
     117        wp_enqueue_script(
     118            $this->plugin_name,
     119            plugin_dir_url( __FILE__ ) . 'js/trackboxx-public.js',
     120            array(),
     121            $this->version,
     122            array('in_footer' => true)
     123        );
    116124    }
    117125
     
    176184                'content-type'    => 'text/plain',
    177185                'user-agent'      => $user_agent,
    178                 'X_FORWARDED_FOR' => $anonymized_ip,
     186                'X_FORWARDED_FOR' => $anonymized_ip
    179187            ),
    180188        );
     
    267275        }
    268276    }
     277
     278    /**
     279     * Track WooCommerce AddToCart action.
     280     *
     281     * @return array
     282     */
     283    public function wc_add_to_cart_args($args, $product) {
     284        $trackboxx_context = array(
     285            'action' => 'AddToCart',
     286            'data' => array(
     287                array(
     288                    'type' => 'AddToCart'
     289                ),
     290                array(
     291                    'type' => 'product',
     292                    'name'  => $product->get_name(),
     293                    'price' => (float) $product->get_price()
     294                )
     295            )
     296        );
     297
     298        $args['attributes']['data-trackboxx-context'] = esc_attr(
     299            wp_json_encode($trackboxx_context)
     300        );
     301
     302        return $args;
     303    }
     304
     305    /**
     306     * Track WooCommerce AddToCart action.
     307     *
     308     * @return void
     309     */
     310    public function wc_after_add_to_cart_button() {
     311        global $product;
     312
     313        $trackboxx_context = array(
     314            'action' => 'AddToCart',
     315            'data' => array(
     316                array(
     317                    'type' => 'AddToCart'
     318                ),
     319                array(
     320                    'type' => 'product',
     321                    'name'  => $product->get_name(),
     322                    'price' => (float) $product->get_price()
     323                )
     324            )
     325        );
     326
     327        echo '<input type="hidden" name="trackboxx_context" value="' . esc_attr( wp_json_encode( $trackboxx_context ) ) . '" />' . "\n";
     328    }
    269329
    270330    /**
  • trackboxx-analytics/trunk/readme.txt

    r3404142 r3452830  
    115115== Changelog ==
    116116
    117 
    118 = 1.3.34 =
     117= 1.4.0 =
    119118* Added view cart tracking functionality for improved event accuracy.
    120119* Added product view tracking to support enhanced behavioral analytics.
     
    122121* Enables Trackboxx to calculate cart abandonment rates more reliably.
    123122* Updated public classes and loader to include new tracking hooks.
     123
     124= 1.3.34 =
     125* Bugfixing Onboarding Process
     126
    124127
    125128= 1.3.33 =
  • trackboxx-analytics/trunk/trackboxx.php

    r3404142 r3452830  
    55 * Author:            Trackboxx
    66 * Author URI:        https://trackboxx.com/
    7  * Version:           1.3.34
     7 * Version:           1.4.0
    88 * Requires PHP:      8.0
    99 * Text Domain:       trackboxx-analytics
     
    2323 * Currently plugin version.
    2424 */
    25 define( 'TRACKBOXX_VERSION', '1.3.34' );
     25define( 'TRACKBOXX_VERSION', '1.4.0' );
    2626
    2727
Note: See TracChangeset for help on using the changeset viewer.