Changeset 2860907
- Timestamp:
- 02/06/2023 03:28:27 PM (3 years ago)
- Location:
- piwik-pro
- Files:
-
- 82 added
- 3 deleted
- 10 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/.htaccess (added)
-
tags/1.2.0/AUTHORS.txt (added)
-
tags/1.2.0/LICENSE.txt (added)
-
tags/1.2.0/README.txt (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/Plugin.php (added)
-
tags/1.2.0/includes/Settings.php (added)
-
tags/1.2.0/includes/index.html (added)
-
tags/1.2.0/index.html (added)
-
tags/1.2.0/languages (added)
-
tags/1.2.0/languages/index.html (added)
-
tags/1.2.0/plugin.php (added)
-
tags/1.2.0/templates (added)
-
tags/1.2.0/templates/async.php (added)
-
tags/1.2.0/templates/index.html (added)
-
tags/1.2.0/templates/link.php (added)
-
tags/1.2.0/templates/nonce.php (added)
-
tags/1.2.0/templates/noscript.php (added)
-
tags/1.2.0/templates/push.php (added)
-
tags/1.2.0/templates/sync.php (added)
-
tags/1.2.0/uninstall.php (added)
-
tags/1.2.0/vendor (added)
-
tags/1.2.0/vendor/autoload.php (added)
-
tags/1.2.0/vendor/classmap.php (added)
-
tags/1.2.0/vendor/clearcode (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/.gitignore (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/.htaccess (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/AUTHORS.txt (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/LICENSE.txt (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/README.md (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/composer.json (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/v6_1_3 (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/v6_1_3/Filterer.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/v6_1_3/Plugin.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/v6_1_3/Singleton.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/v6_1_3/Templater.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-framework/src/v6_1_3/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/.gitignore (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/.htaccess (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/AUTHORS.txt (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/LICENSE.txt (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/README.md (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/composer.json (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3 (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/Settings.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/index.html (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/input.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/menu.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/page.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/section.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/select.php (added)
-
tags/1.2.0/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/textarea.php (added)
-
trunk/README.txt (modified) (5 diffs)
-
trunk/includes/Plugin.php (modified) (3 diffs)
-
trunk/includes/Settings.php (modified) (2 diffs)
-
trunk/plugin.php (modified) (2 diffs)
-
trunk/templates/push.php (added)
-
trunk/uninstall.php (modified) (2 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/classmap.php (added)
-
trunk/vendor/clearcode/wordpress-framework/README.md (modified) (1 diff)
-
trunk/vendor/clearcode/wordpress-framework/composer.json (modified) (1 diff)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_2 (deleted)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_3 (added)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_3/Filterer.php (added)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_3/Plugin.php (added)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_3/Singleton.php (added)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_3/Templater.php (added)
-
trunk/vendor/clearcode/wordpress-framework/src/v6_1_3/index.html (added)
-
trunk/vendor/clearcode/wordpress-settings/README.md (modified) (1 diff)
-
trunk/vendor/clearcode/wordpress-settings/composer.json (modified) (1 diff)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_1 (deleted)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3 (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/Settings.php (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/index.html (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/index.html (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/input.php (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/menu.php (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/page.php (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/section.php (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/select.php (added)
-
trunk/vendor/clearcode/wordpress-settings/src/v1_1_3/templates/textarea.php (added)
-
trunk/vendor/composer (deleted)
Legend:
- Unmodified
- Added
- Removed
-
piwik-pro/trunk/README.txt
r2740350 r2860907 1 1 === Piwik PRO === 2 2 Contributors: piwikpro, piotrpress 3 Tags: Piwik PRO, Piwik, analytics, website stats 3 Tags: Piwik PRO, Piwik, analytics, website stats, woocommerce 4 4 Requires at least: 5.7 5 Tested up to: 6. 06 Stable tag: 1. 1.15 Tested up to: 6.1.1 6 Stable tag: 1.2.0 7 7 Requires PHP: 7.4 8 8 License: GPLv3 … … 13 13 == Description == 14 14 15 A simple plugin to add the [Piwik PRO](https://piwik.pro/) container (with tracking code) to your WordPress site .15 A simple plugin to add the [Piwik PRO](https://piwik.pro/) container (with tracking code) to your WordPress site and automatically track ecommerce from your WooCommerce store. 16 16 17 17 = What is Piwik PRO? = … … 46 46 * **Additional container (sync):** Add this container if you want to use sync tags. It loads tags before the page content loads. 47 47 48 = WooCommerce: Does this plugin automatically track ecommerce? = 49 50 Yes, this plugin automatically tracks events like ecommerce orders and abandoned carts, which result in full ecommerce reporting in Piwik PRO. To see the collected data, just turn on [ecommerce reports](https://help.piwik.pro/support/reports/ecommerce-reports/) in: 51 52 `Piwik PRO > Menu > Administration > Reports > Show ecommerce reports.` 53 48 54 = When should I rename the data layer? = 49 55 … … 58 64 Content Security Policy restricts third-party tools from loading codes on the website and allows to fetch only approved origins of content. To support Content Security Policy mechanism, you need to add a `nonce` value as an attribute to containers and scripts that these containers load. 59 65 60 To add a `nonce` value, follow these steps: 61 62 1. Add to a `function.php` file in yours theme the following code: 66 To add a `nonce` value add to a `function.php` file in yours theme the following code: 63 67 64 68 `add_filter( 'piwik_pro_nonce', function() { return wp_create_nonce( time() ); } );` … … 105 109 == Changelog == 106 110 111 = 1.2.0 = 112 **Release date: 06.02.2023** 113 114 * Add: Added support for `getTrackingSource()` Piwik PRO's event. 115 * Add: Added support for `trackEcommerceCartUpdate()` and `trackEcommerceOrder()` Piwik PRO's events for `WooCommerce` plugin. 116 * Fix: Remove `piwik_pro` option in every site in multisite installation during uninstallation. 117 118 = 1.1.1 = 119 **Release date: 06.10.2022** 120 121 * Test: Tested up to WordPress 6.0 122 107 123 = 1.1.0 = 108 124 **Release date: 05.08.2021** -
piwik-pro/trunk/includes/Plugin.php
r2578624 r2860907 2 2 3 3 /* 4 Copyright (C) 202 1by Piwik PRO <https://piwik.pro>4 Copyright (C) 2023 by Piwik PRO <https://piwik.pro> 5 5 and associates (see AUTHORS.txt file). 6 6 … … 24 24 namespace PiwikPRO; 25 25 26 use Clearcode\Framework\v6_1_2\Templater;26 use PiwikPRO\Vendor\Clearcode\Framework\v6_1_3\Templater; 27 27 28 28 defined( 'ABSPATH' ) or exit; 29 29 30 30 if ( ! class_exists( __NAMESPACE__ . '\Plugin' ) ) { 31 class Plugin extends \ Clearcode\Framework\v6_1_2\Plugin {31 class Plugin extends \PiwikPRO\Vendor\Clearcode\Framework\v6_1_3\Plugin { 32 32 protected $settings = []; 33 33 protected $defaults = [ … … 83 83 } 84 84 85 public function action_wp_footer() { 86 foreach ( [ 'url', 'id', 'layer' ] as $key ) if ( ! $this->settings[ $key ] ) return; 87 if ( ! $this->settings[ 'sync' ] and ! $this->settings[ 'async' ] ) return; 88 89 echo wp_get_inline_script_tag( 90 $this->render( 'push', [ 'arguments' => [ 91 'setTrackingSource', 92 'wordpress', 93 self::get( 'version' ) 94 ] ] ) 95 ); 96 97 if ( ! class_exists( 'WooCommerce' ) ) return; 98 if ( is_order_received_page() and $order = $this->get_order() ) { 99 foreach ( $order->get_items() as $order_item ) 100 echo wp_get_inline_script_tag( 101 $this->render( 'push', [ 'arguments' => array_merge( 102 [ 'addEcommerceItem' ], 103 $this->get_product_data( $order_item[ 'product_id' ], $order_item[ 'quantity' ] ) 104 ) ] ) 105 ); 106 107 echo wp_get_inline_script_tag( 108 $this->render( 'push', [ 'arguments' => [ 109 'trackEcommerceOrder', 110 $order->get_id(), 111 floatval( $order->get_total() ), 112 floatval( $order->get_subtotal() ), 113 floatval( $order->get_total_tax() ), 114 floatval( $order->get_shipping_total() ), 115 floatval( $order->get_total_discount() ) 116 ] ] ) 117 ); 118 } elseif( WC()->cart->get_cart_contents() ) { 119 foreach ( WC()->cart->get_cart_contents() as $cart_item ) 120 echo wp_get_inline_script_tag( 121 $this->render( 'push', [ 'arguments' => array_merge( 122 [ 'addEcommerceItem' ], 123 $this->get_product_data( $cart_item[ 'product_id' ], $cart_item[ 'quantity' ] ) 124 ) ] ) 125 ); 126 127 echo wp_get_inline_script_tag( 128 $this->render( 'push', [ 'arguments' => [ 129 'trackEcommerceCartUpdate', 130 floatval( WC()->cart->get_totals()[ 'total' ] ) 131 ] ] ) 132 ); 133 } 134 } 135 136 protected function get_order() { 137 global $wp; 138 139 $order_id = is_numeric( $wp->query_vars[ 'order-received' ] ) ? intval( $wp->query_vars[ 'order-received' ] ) : 0; 140 if ( ! $order_id ) return null; 141 142 $order = wc_get_order( $order_id ); 143 return ( $order and ! $order->has_status( 'failed' ) ) ? $order : null; 144 } 145 146 protected function get_product_data( $product_id, $quantity = 1 ) { 147 return ( $product = wc_get_product( $product_id ) ) ? [ 148 $product->get_sku() ?: (string)$product->get_id(), 149 $product->get_name(), 150 $this->get_product_categories( $product->get_id() ), 151 floatval( $product->get_price() ), 152 intval( $quantity ) 153 ] : []; 154 } 155 156 protected function get_product_categories( $product_id ) { 157 $categories = []; 158 foreach ( get_the_terms( $product_id, 'product_cat' ) as $term ) 159 $categories[] = $term->name; 160 161 switch ( count( $categories ) ) { 162 case 0: return ''; 163 case 1: return $categories[ 0 ]; 164 default : return array_slice( $categories, 0, 5 ); 165 } 166 } 167 85 168 protected function render( $template, $args ) { 86 169 return call_user_func( -
piwik-pro/trunk/includes/Settings.php
r2522592 r2860907 2 2 3 3 /* 4 Copyright (C) 202 1by Piwik PRO <https://piwik.pro>4 Copyright (C) 2023 by Piwik PRO <https://piwik.pro> 5 5 and associates (see AUTHORS.txt file). 6 6 … … 24 24 namespace PiwikPRO; 25 25 26 use Clearcode\Framework\v6_1_2\Templater;26 use PiwikPRO\Vendor\Clearcode\Framework\v6_1_3\Templater; 27 27 28 28 defined( 'ABSPATH' ) or exit; 29 29 30 30 if ( ! class_exists( __NAMESPACE__ . '\Settings' ) ) { 31 class Settings extends \ Clearcode\Settings\v1_1_1\Settings {31 class Settings extends \PiwikPRO\Vendor\Clearcode\Settings\v1_1_3\Settings { 32 32 const OPTION = 'piwik_pro'; 33 33 const PAGE = 'piwik-pro'; -
piwik-pro/trunk/plugin.php
r2628598 r2860907 5 5 * Plugin URI: https://wordpress.org/plugins/piwik-pro/ 6 6 * Description: Adds the Piwik PRO container (with tracking code) to your WordPress site. 7 * Version: 1. 1.17 * Version: 1.2.0 8 8 * Requires at least: 5.7 9 9 * Requires PHP: 7.4 … … 15 15 * Domain Path: /languages/ 16 16 17 Copyright (C) 202 1by Piwik PRO <https://piwik.pro>17 Copyright (C) 2023 by Piwik PRO <https://piwik.pro> 18 18 and associates (see AUTHORS.txt file). 19 19 -
piwik-pro/trunk/uninstall.php
r2516197 r2860907 2 2 3 3 /* 4 Copyright (C) 202 1by Piwik PRO <https://piwik.pro>4 Copyright (C) 2023 by Piwik PRO <https://piwik.pro> 5 5 and associates (see AUTHORS.txt file). 6 6 … … 24 24 defined( 'WP_UNINSTALL_PLUGIN' ) or exit; 25 25 26 delete_option( 'piwik_pro' ); 26 if ( is_multisite() ) foreach ( get_sites() as $site ) delete_blog_option( $site->blog_id, 'piwik_pro' ); 27 else delete_option( 'piwik_pro' ); -
piwik-pro/trunk/vendor/autoload.php
r2516197 r2860907 1 <?php 2 3 // autoload.php @generated by Composer 4 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 7 return ComposerAutoloaderInit60fe4dd621c54e72c9975ba653775fc5::getLoader(); 1 <?php return spl_autoload_register( function( string $class ) { 2 $map = require __DIR__ . '/classmap.php'; 3 if ( isset( $map[ $class ] ) ) require dirname( __DIR__ ) . $map[ $class ]; 4 } ); -
piwik-pro/trunk/vendor/clearcode/wordpress-framework/README.md
r2516197 r2860907 11 11 # License 12 12 13 GPL3.0+ see LICENSE.txt and AUTHORS.txt13 GPL3.0+ see [LICENSE.txt](LICENSE.txt) and [AUTHORS.txt](AUTHORS.txt) -
piwik-pro/trunk/vendor/clearcode/wordpress-framework/composer.json
r2516197 r2860907 25 25 }, 26 26 "require": { 27 "php": ">=7. 2"27 "php": ">=7.4" 28 28 }, 29 29 "autoload": { -
piwik-pro/trunk/vendor/clearcode/wordpress-settings/README.md
r2516197 r2860907 70 70 # License 71 71 72 GPL3.0+ see LICENSE.txt and AUTHORS.txt72 GPL3.0+ see [LICENSE.txt](LICENSE.txt) and [AUTHORS.txt](AUTHORS.txt) -
piwik-pro/trunk/vendor/clearcode/wordpress-settings/composer.json
r2516197 r2860907 25 25 }, 26 26 "require": { 27 "php": ">=7. 2",28 "clearcode/wordpress-framework": "6.1. 2"27 "php": ">=7.4", 28 "clearcode/wordpress-framework": "6.1.3" 29 29 }, 30 30 "autoload": {
Note: See TracChangeset
for help on using the changeset viewer.