Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/334-php-unittests-notice
Browse files Browse the repository at this point in the history
  • Loading branch information
tomalec authored Nov 27, 2023
2 parents 5649cd7 + 6a5812b commit a468648
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 14 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
push:
branches:
- trunk

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
BuildExtensionBundle:
name: Build extension bundle
runs-on: ubuntu-latest
env:
FORCE_COLOR: 2
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
with:
install-deps: "no"

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
with:
node-version-file: ".nvmrc"
ignore-scripts: "no"

- name: Build production bundle
run: |
echo "::group::Build log"
npm run build
echo "::endgroup::"
- name: Publish dev build to GitHub
uses: woocommerce/grow/publish-extension-dev-build@actions-v1
with:
extension-asset-path: woocommerce-google-analytics-integration.zip
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# WooCommerce Google Analytics Integration

[![PHP Unit Tests](https://github.com/woocommerce/woocommerce-google-analytics-integration/actions/workflows/php-unit-tests.yml/badge.svg)](https://github.com/woocommerce/woocommerce-google-analytics-integration/actions/workflows/php-unit-tests.yml)
[![JavaScript Linting](https://github.com/woocommerce/woocommerce-google-analytics-integration/actions/workflows/js-linting.yml/badge.svg)](https://github.com/woocommerce/woocommerce-google-analytics-integration/actions/workflows/js-linting.yml)
[![Build](https://github.com/woocommerce/woocommerce-google-analytics-integration/actions/workflows/build.yml/badge.svg)](https://github.com/woocommerce/woocommerce-google-analytics-integration/actions/workflows/build.yml)

WordPress plugin: Provides the integration between WooCommerce and Google Analytics.

Will be required for WooCommerce shops using the integration from WooCommerce 2.1 and up.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"wp-coding-standards/wpcs": "^3.0",
"exussum12/coverage-checker": "^1.0",
"phpunit/phpunit": "^9.5",
"yoast/phpunit-polyfills": "^1.0"
"yoast/phpunit-polyfills": "^1.1.0"
},
"config": {
"allow-plugins": {
Expand Down
23 changes: 13 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/class-wc-google-analytics-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static function listing_click( $product ) {

wc_enqueue_js(
"
$( '.product.post-" . esc_js( $product->get_id() ) . ' a , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() {
$( '.product.post-" . esc_js( $product->get_id() ) . ' a.button , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() {
if ( false === $(this).hasClass( 'product_type_variable' ) && false === $(this).hasClass( 'product_type_grouped' ) ) {
" . self::tracker_var() . "( 'ec:addProduct', {
'id': '" . esc_js( $product->get_id() ) . "',
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-google-gtag-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function variant_data( $data, $product, $variation ) {
* @return string
*/
public static function get_event_code( string $event, $data ): string {
return sprintf( "%s('event', '%s', %s)", self::tracker_var(), esc_js( $event ), ( is_array( $data ) ? self::format_event_data( $data ) : $data ) );
return sprintf( "%s('event', '%s', %s);", self::tracker_var(), esc_js( $event ), ( is_array( $data ) ? self::format_event_data( $data ) : $data ) );
}

/**
Expand Down Expand Up @@ -222,7 +222,7 @@ public static function listing_click( $product ) {

wc_enqueue_js(
"
$( '.product.post-" . esc_js( $product->get_id() ) . ' a , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() {
$( '.product.post-" . esc_js( $product->get_id() ) . ' a.button , .product.post-' . esc_js( $product->get_id() ) . " button' ).on('click', function() {
if ( false === $(this).hasClass( 'product_type_variable' ) && false === $(this).hasClass( 'product_type_grouped' ) ) {
$add_to_cart_event_code
} else {
Expand Down

0 comments on commit a468648

Please sign in to comment.