Version Description
- Added shopping cart actions and product view support.
- Minor bug fixes.
Download this release
Release Info
Developer | sitewit |
Plugin | Google Ads & Marketing by Kliken |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- changelog.txt +4 -0
- classes/class-helper.php +55 -0
- classes/class-rest-products-controller.php +8 -0
- kliken-marketing-for-google.php +1 -1
- languages/kliken-marketing-for-google-de_CH.mo +0 -0
- languages/kliken-marketing-for-google-de_DE.mo +0 -0
- languages/kliken-marketing-for-google-es_ES.mo +0 -0
- languages/kliken-marketing-for-google-fr_FR.mo +0 -0
- languages/kliken-marketing-for-google-nl_NL.mo +0 -0
- languages/kliken-marketing-for-google.pot +3 -3
- pages/cartscript.php +61 -0
- pages/productscript.php +49 -0
- readme.txt +5 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +2 -2
changelog.txt
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
*** Google Ads for WooCommerce Changelog ***
|
2 |
|
|
|
|
|
|
|
|
|
3 |
2019-07-02 - version 1.0.2
|
4 |
* Minor bug fixes.
|
5 |
|
1 |
*** Google Ads for WooCommerce Changelog ***
|
2 |
|
3 |
+
2020-02-20 - version 1.0.3
|
4 |
+
* Added shopping cart actions and product view support.
|
5 |
+
* Minor bug fixes.
|
6 |
+
|
7 |
2019-07-02 - version 1.0.2
|
8 |
* Minor bug fixes.
|
9 |
|
classes/class-helper.php
CHANGED
@@ -203,6 +203,24 @@ class Helper {
|
|
203 |
return;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
// Check if is order received page.
|
207 |
if ( is_order_received_page() ) {
|
208 |
$order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : 0;
|
@@ -304,6 +322,43 @@ class Helper {
|
|
304 |
return $transaction;
|
305 |
}
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
/**
|
308 |
* Build the WooCommerce authorization URL
|
309 |
* Doc: https://woocommerce.github.io/woocommerce-rest-api-docs/#rest-api-keys
|
203 |
return;
|
204 |
}
|
205 |
|
206 |
+
// Check if is cart/checkout page.
|
207 |
+
if ( is_cart() || is_checkout() ) {
|
208 |
+
$cart = self::build_cart_data();
|
209 |
+
|
210 |
+
if ( null !== $cart ) {
|
211 |
+
include_once KK_WC_PLUGIN_DIR . 'pages/cartscript.php';
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
// Check if is product page.
|
216 |
+
if ( is_product() ) {
|
217 |
+
$product = self::build_product_data();
|
218 |
+
|
219 |
+
if ( null !== $product ) {
|
220 |
+
include_once KK_WC_PLUGIN_DIR . 'pages/productscript.php';
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
// Check if is order received page.
|
225 |
if ( is_order_received_page() ) {
|
226 |
$order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : 0;
|
322 |
return $transaction;
|
323 |
}
|
324 |
|
325 |
+
/**
|
326 |
+
* Build product data preparing to be recorded by our tracking script
|
327 |
+
*
|
328 |
+
* @return array|null
|
329 |
+
*/
|
330 |
+
public static function build_product_data() {
|
331 |
+
$product = wc_get_product();
|
332 |
+
|
333 |
+
if ( ! $product ) {
|
334 |
+
return null;
|
335 |
+
}
|
336 |
+
|
337 |
+
$product_info = [
|
338 |
+
'sku' => $product->get_sku(),
|
339 |
+
'name' => $product->get_name(),
|
340 |
+
'price' => $product->get_price(),
|
341 |
+
'category' => $product->get_category_ids()
|
342 |
+
];
|
343 |
+
|
344 |
+
return $product_info;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Build current cart data preparing to be recorded by our tracking script
|
349 |
+
*
|
350 |
+
* @return array|null
|
351 |
+
*/
|
352 |
+
public static function build_cart_data() {
|
353 |
+
$cart = WC()->cart;
|
354 |
+
|
355 |
+
if ( null === $cart || $cart->is_empty() ) {
|
356 |
+
return null;
|
357 |
+
}
|
358 |
+
|
359 |
+
return $cart->get_cart();
|
360 |
+
}
|
361 |
+
|
362 |
/**
|
363 |
* Build the WooCommerce authorization URL
|
364 |
* Doc: https://woocommerce.github.io/woocommerce-rest-api-docs/#rest-api-keys
|
classes/class-rest-products-controller.php
CHANGED
@@ -109,6 +109,14 @@ class REST_Products_Controller extends WC_REST_Products_Controller_Compat {
|
|
109 |
* @return array
|
110 |
*/
|
111 |
protected function prepare_objects_query( $request ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
$args = parent::prepare_objects_query( $request );
|
113 |
|
114 |
// Reset the date query to look up post_modified column instead.
|
109 |
* @return array
|
110 |
*/
|
111 |
protected function prepare_objects_query( $request ) {
|
112 |
+
if ( empty( $request['page'] ) ) {
|
113 |
+
$request['page'] = 0;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( empty( $request['orderby'] ) ) {
|
117 |
+
$request['orderby'] = 'modified';
|
118 |
+
}
|
119 |
+
|
120 |
$args = parent::prepare_objects_query( $request );
|
121 |
|
122 |
// Reset the date query to look up post_modified column instead.
|
kliken-marketing-for-google.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Google Ads for WooCommerce
|
4 |
Plugin URI: https://woo.kliken.com/
|
5 |
Description: The automated Google Shopping solution to get your products found on Google, and grow your WooCommerce Store!
|
6 |
-
Version: 1.0.
|
7 |
Author: Kliken
|
8 |
Author URI: http://kliken.com/
|
9 |
Developer: Kliken
|
3 |
Plugin Name: Google Ads for WooCommerce
|
4 |
Plugin URI: https://woo.kliken.com/
|
5 |
Description: The automated Google Shopping solution to get your products found on Google, and grow your WooCommerce Store!
|
6 |
+
Version: 1.0.3
|
7 |
Author: Kliken
|
8 |
Author URI: http://kliken.com/
|
9 |
Developer: Kliken
|
languages/kliken-marketing-for-google-de_CH.mo
CHANGED
Binary file
|
languages/kliken-marketing-for-google-de_DE.mo
CHANGED
Binary file
|
languages/kliken-marketing-for-google-es_ES.mo
CHANGED
Binary file
|
languages/kliken-marketing-for-google-fr_FR.mo
CHANGED
Binary file
|
languages/kliken-marketing-for-google-nl_NL.mo
CHANGED
Binary file
|
languages/kliken-marketing-for-google.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Google Ads for WooCommerce 1.0.
|
6 |
"Report-Msgid-Bugs-To: http://www.sitewit.com/contact/\n"
|
7 |
-
"POT-Creation-Date: 2020-02-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -25,7 +25,7 @@ msgstr ""
|
|
25 |
"X-Generator: grunt-wp-i18n1.0.2\n"
|
26 |
|
27 |
#. translators: %s: A hyperlink
|
28 |
-
#: classes/class-helper.php:
|
29 |
msgid ""
|
30 |
"<strong>Google Ads for WooCommerce plugin is almost ready.</strong> <a href="
|
31 |
"\"%s\">Click here</a> to get started."
|
2 |
# This file is distributed under the GNU General Public License v3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Google Ads for WooCommerce 1.0.3\n"
|
6 |
"Report-Msgid-Bugs-To: http://www.sitewit.com/contact/\n"
|
7 |
+
"POT-Creation-Date: 2020-02-24 16:58:53+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
25 |
"X-Generator: grunt-wp-i18n1.0.2\n"
|
26 |
|
27 |
#. translators: %s: A hyperlink
|
28 |
+
#: classes/class-helper.php:465
|
29 |
msgid ""
|
30 |
"<strong>Google Ads for WooCommerce plugin is almost ready.</strong> <a href="
|
31 |
"\"%s\">Click here</a> to get started."
|
pages/cartscript.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains JS script to register a cart page.
|
4 |
+
*
|
5 |
+
* @package Kliken Marketing for Google
|
6 |
+
*/
|
7 |
+
|
8 |
+
defined( 'ABSPATH' ) || exit;
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
<script type="text/javascript">
|
13 |
+
var swPreRegister = function() {
|
14 |
+
let itemsForGTAG = [];
|
15 |
+
let swCart = [];
|
16 |
+
<?php foreach ($cart as $key => $value) : ?>
|
17 |
+
<?php $product = $value['data']; ?>
|
18 |
+
sw.track("AddToCart",
|
19 |
+
{
|
20 |
+
content_type: "product",
|
21 |
+
content_ids: "<?php echo esc_attr( $product->get_sku() ); ?>",
|
22 |
+
content_name: "<?php echo esc_attr( $product->get_name() ); ?>",
|
23 |
+
value: "<?php echo esc_attr( $product->get_price() ); ?>",
|
24 |
+
currency: sw.config.currency
|
25 |
+
}
|
26 |
+
);
|
27 |
+
|
28 |
+
itemsForGTAG.push(
|
29 |
+
{
|
30 |
+
"id": "<?php echo esc_attr( $product->get_sku() ); ?>",
|
31 |
+
"name": "<?php echo esc_attr( $product->get_name() ); ?>",
|
32 |
+
"price": "<?php echo esc_attr( $product->get_price() ); ?>",
|
33 |
+
"quantity": "<?php echo esc_attr( $value['quantity'] ); ?>",
|
34 |
+
"google_business_vertical": "retail"
|
35 |
+
}
|
36 |
+
);
|
37 |
+
|
38 |
+
swCart.push(
|
39 |
+
{
|
40 |
+
"id": "<?php echo esc_attr( $product->get_sku() ); ?>",
|
41 |
+
"name": "<?php echo esc_attr( $product->get_name() ); ?>",
|
42 |
+
"price": "<?php echo esc_attr( $product->get_price() ); ?>",
|
43 |
+
"quantity": "<?php echo esc_attr( $value['quantity'] ); ?>",
|
44 |
+
"currency": sw.config.currency
|
45 |
+
}
|
46 |
+
);
|
47 |
+
<?php endforeach ?>
|
48 |
+
|
49 |
+
sw.gEvent("add_to_cart",
|
50 |
+
{
|
51 |
+
"items": itemsForGTAG
|
52 |
+
}
|
53 |
+
);
|
54 |
+
|
55 |
+
sw.register_shopcart(
|
56 |
+
{
|
57 |
+
"items": swCart
|
58 |
+
}
|
59 |
+
);
|
60 |
+
};
|
61 |
+
</script>
|
pages/productscript.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Contains JS script to register a product page.
|
4 |
+
*
|
5 |
+
* @package Kliken Marketing for Google
|
6 |
+
*/
|
7 |
+
|
8 |
+
defined( 'ABSPATH' ) || exit;
|
9 |
+
|
10 |
+
?>
|
11 |
+
|
12 |
+
<script type="text/javascript">
|
13 |
+
var swPreRegister = function() {
|
14 |
+
sw.track('ViewContent',
|
15 |
+
{
|
16 |
+
content_type: 'product',
|
17 |
+
content_ids: "<?php echo esc_attr( $product['sku'] ); ?>",
|
18 |
+
content_name: "<?php echo esc_attr( $product['name'] ); ?>",
|
19 |
+
content_category: "<?php echo esc_attr( implode( ',', $product['category'] ) ); ?>"
|
20 |
+
}
|
21 |
+
);
|
22 |
+
|
23 |
+
sw.gEvent('view_item',
|
24 |
+
{
|
25 |
+
items: [
|
26 |
+
{
|
27 |
+
"id": "<?php echo esc_attr( $product['sku'] ); ?>",
|
28 |
+
"name": "<?php echo esc_attr( $product['name'] ); ?>",
|
29 |
+
"category": "<?php echo esc_attr( implode( ',', $product['category'] ) ); ?>",
|
30 |
+
"google_business_vertical": "retail"
|
31 |
+
}
|
32 |
+
]
|
33 |
+
}
|
34 |
+
);
|
35 |
+
|
36 |
+
sw.gEvent('page_view',
|
37 |
+
{
|
38 |
+
"ecomm_prodid": "<?php echo esc_attr( $product['sku'] ); ?>"
|
39 |
+
}
|
40 |
+
);
|
41 |
+
|
42 |
+
sw.register_product_view(
|
43 |
+
{
|
44 |
+
"id": "<?php echo esc_attr( $product['sku'] ); ?>",
|
45 |
+
"category": "<?php echo esc_attr( implode( ',', $product['category'] ) ); ?>"
|
46 |
+
}
|
47 |
+
);
|
48 |
+
};
|
49 |
+
</script>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: advertising, adwords, analytics, bing, google, leads, marketing, marketing
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv3 or later License
|
9 |
URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -48,6 +48,10 @@ This is our monthly fee for creating, managing, and optimizing all aspects of yo
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
51 |
= 1.0.2 =
|
52 |
* Minor bug fixes.
|
53 |
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 1.0.3
|
8 |
License: GPLv3 or later License
|
9 |
URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.0.3 =
|
52 |
+
* Added shopping cart actions and product view support.
|
53 |
+
* Minor bug fixes.
|
54 |
+
|
55 |
= 1.0.2 =
|
56 |
* Minor bug fixes.
|
57 |
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInite93b4eef0b9c119749a112a875b734fd::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit8d05e6ff15e07dd67db7d411953e0c56
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInite93b4eef0b9c119749a112a875b734fd
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInite93b4eef0b9c119749a112a875b734fd', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInite93b4eef0b9c119749a112a875b734fd', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInite93b4eef0b9c119749a112a875b734fd::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $classMap = array (
|
10 |
'Kliken\\WcPlugin\\Helper' => __DIR__ . '/../..' . '/classes/class-helper.php',
|
@@ -20,7 +20,7 @@ class ComposerStaticInit8d05e6ff15e07dd67db7d411953e0c56
|
|
20 |
public static function getInitializer(ClassLoader $loader)
|
21 |
{
|
22 |
return \Closure::bind(function () use ($loader) {
|
23 |
-
$loader->classMap =
|
24 |
|
25 |
}, null, ClassLoader::class);
|
26 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInite93b4eef0b9c119749a112a875b734fd
|
8 |
{
|
9 |
public static $classMap = array (
|
10 |
'Kliken\\WcPlugin\\Helper' => __DIR__ . '/../..' . '/classes/class-helper.php',
|
20 |
public static function getInitializer(ClassLoader $loader)
|
21 |
{
|
22 |
return \Closure::bind(function () use ($loader) {
|
23 |
+
$loader->classMap = ComposerStaticInite93b4eef0b9c119749a112a875b734fd::$classMap;
|
24 |
|
25 |
}, null, ClassLoader::class);
|
26 |
}
|