Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tracking for classic pages #328

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
0e945df
Remove inline JS tracking
Nov 8, 2023
5eee69e
Remove abstract methods
Nov 8, 2023
273ef92
Add inline script data
Nov 8, 2023
01facf0
Format and attach event data in abstract class
Nov 9, 2023
18f6ba1
Map classic hooks to Blocks and inline event data
Nov 10, 2023
4d33305
Update wcgaiData single product name
Nov 17, 2023
6a563e2
Remove key for wcgaiData products
Nov 17, 2023
3506c88
Fix array keys
Nov 17, 2023
738f3ec
Update event map and script data
Nov 17, 2023
d5a659e
Add a tracker utility
Nov 17, 2023
977f49a
Update utils
Nov 17, 2023
e24a184
Move actions to data formatting functions
Nov 17, 2023
bb6ecc7
Add tracker utility
Nov 17, 2023
bd5f4cf
Add blocks and classic integrations
Nov 17, 2023
e14d27f
Add config file
Nov 17, 2023
3a36b96
Add new entry point
Nov 17, 2023
a2349aa
Remove enqueue_standard_tracking_code
Nov 20, 2023
82d2ce2
Update method signature
Nov 20, 2023
5ebea9c
Remove event map
Dec 7, 2023
d135e41
Rename data formatters
Dec 7, 2023
1fb3336
Restructure Tracker
Dec 7, 2023
d114b28
Update tracking
Dec 7, 2023
d7d9add
Reduce categories data to name only
Dec 7, 2023
4d65dfc
Update event => WC hook map
Dec 7, 2023
08ce30e
Update Tracker
Dec 10, 2023
326c59e
Add utility to find a single product by its ID
Dec 10, 2023
58a6fc2
Allow for single entry for data type in script data
Dec 10, 2023
89900a1
Track add to cart events
Dec 10, 2023
cabeb45
Fix JS formatting issues
martynmjones Jan 18, 2024
87d82f6
Remove unused PHP tests
martynmjones Jan 18, 2024
e4dd675
Update composer lock file
martynmjones Jan 18, 2024
6301d5e
Update composer.json
martynmjones Jan 18, 2024
17abd40
Remove calls to deleted functions
martynmjones Jan 19, 2024
d9c754b
Update cart formatting
martynmjones Jan 23, 2024
8616b72
Add remove_from_cart tracking
martynmjones Jan 23, 2024
67bfd6b
Add begin_checkout tracking
martynmjones Jan 24, 2024
3c4f670
Add select_content tracking
martynmjones Jan 24, 2024
af0b665
Add purchase tracking
martynmjones Jan 24, 2024
3a24994
Fix param description
martynmjones Jan 24, 2024
e12c442
Fix price formatting
martynmjones Jan 25, 2024
f99c620
Add check for enabled events
martynmjones Jan 25, 2024
5ef1fb6
Use correct product identifier
martynmjones Jan 25, 2024
2646ad9
Add product identifier to cart item
martynmjones Jan 25, 2024
48ee481
Add unit tests
martynmjones Jan 25, 2024
dc7fb24
Refactor test_script_data to support previous versions of PHP
martynmjones Jan 25, 2024
66142e2
Refactor getProductId util
martynmjones Jan 25, 2024
9104cb9
Add support for product variations
martynmjones Jan 26, 2024
9ba0a7f
Update plugin name to Google Analytics for WooCommerce
martynmjones Jan 31, 2024
2ea428c
Additional name updates
martynmjones Feb 1, 2024
155b32f
Merge pull request #353 from woocommerce/update/branding-to-google-an…
martynmjones Feb 1, 2024
5395991
Simplify tracker event handler API,
tomalec Feb 8, 2024
8fa9baf
Merge pull request #357 from woocommerce/update/tracking-for-classic-…
martynmjones Feb 9, 2024
c1bb15a
Fix price formatting
martynmjones Feb 9, 2024
b1a0de1
Remove unnecessary check
martynmjones Feb 9, 2024
bed5877
Remove demo comment
martynmjones Feb 9, 2024
7fcab41
Assign formatter to constant inside eventHandler
martynmjones Feb 9, 2024
c4931e3
Simplify set_script_data
martynmjones Feb 9, 2024
46dd222
Rename tracker_var to tracker_function_name
martynmjones Feb 9, 2024
930cf21
Update unit tests
martynmjones Feb 9, 2024
db37466
Update config export
martynmjones Feb 9, 2024
d625984
Fix addedToCart declaration
martynmjones Feb 9, 2024
9f60881
Remove spread operator
martynmjones Feb 19, 2024
9a1e058
Update classic select_content tracking
martynmjones Feb 26, 2024
234fe84
Update remove_from_cart tracking and add mini-cart support
martynmjones Feb 26, 2024
7ff8829
Update select_content selector
martynmjones Feb 26, 2024
8272538
Add comment describing why some actions are removed
martynmjones Feb 26, 2024
81f719e
Fix linting errors
martynmjones Feb 26, 2024
1bd5af3
Fix ID mismatch when removing a variation from cart
martynmjones Feb 26, 2024
c979cf0
Adjust append_script_data
martynmjones Feb 26, 2024
e893d8c
Avoid overwriting third-party event handlers
martynmjones Feb 27, 2024
94cc036
Adjust select_content conditions and update comment
martynmjones Feb 27, 2024
e27406d
Fix spacing
martynmjones Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contributing

Thanks for your interest in contributing to WooCommerce Google Analytics Integration!
Thanks for your interest in contributing to Google Analytics for WooCommerce!

## Guidelines

Like the WooCommerce project, we want to ensure a welcoming environment for everyone. With that in mind, all contributors are expected to follow our [Code of Conduct](./CODE_OF_CONDUCT.md).

If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) WooCommerce Google Analytics Integration, commit your changes, and [submit a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) 🎉
If you wish to contribute code, please read the information in the sections below. Then [fork](https://help.github.com/articles/fork-a-repo/) Google Analytics for WooCommerce, commit your changes, and [submit a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) 🎉

WooCommerce Google Analytics Integration is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license.
Google Analytics for WooCommerce is licensed under the GPLv3+, and all contributions to the project will be released under the same license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv3+ license.

## Reporting Security Issues

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# WooCommerce Google Analytics Integration
# Google Analytics for WooCommerce

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

Expand All @@ -10,7 +10,7 @@ Will be required for WooCommerce shops using the integration from WooCommerce 2.

## NPM Scripts

WooCommerce Google Analytics Integration utilizes npm scripts for task management utilities.
Google Analytics for WooCommerce utilizes npm scripts for task management utilities.

`npm run build` - Runs the tasks necessary for a release. These may include building JavaScript, SASS, CSS minification, and language files.

Expand All @@ -34,4 +34,4 @@ Alternatively, run `npm run lint:php:diff` to run coding standards checks agains

## Docs

- [Hooks defined or used in WooCommerce Google Analytics Integration](./docs/Hooks.md)
- [Hooks defined or used in Google Analytics for WooCommerce](./docs/Hooks.md)
140 changes: 0 additions & 140 deletions assets/js/src/actions.js

This file was deleted.

11 changes: 11 additions & 0 deletions assets/js/src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* global wcgaiData */
/* eslint-disable camelcase */
export const {
config,
events,
cart,
products,
product,
added_to_cart: addedToCart,
order,
} = wcgaiData;
14 changes: 0 additions & 14 deletions assets/js/src/ga-integration.js

This file was deleted.

6 changes: 6 additions & 0 deletions assets/js/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Initialize tracking for classic WooCommerce pages
import { trackClassicIntegration } from './integrations/classic';
trackClassicIntegration();

// Initialize tracking for Block based WooCommerce pages
import './integrations/blocks';
53 changes: 53 additions & 0 deletions assets/js/src/integrations/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { removeAction } from '@wordpress/hooks';
import { addUniqueAction } from '../utils';
import { tracker } from '../tracker';
import { ACTION_PREFIX, NAMESPACE } from '../constants';

addUniqueAction(
`${ ACTION_PREFIX }-product-list-render`,
NAMESPACE,
tracker.eventHandler( 'view_item_list' )
);

addUniqueAction(
`${ ACTION_PREFIX }-product-render`,
NAMESPACE,
tracker.eventHandler( 'view_item' )
);

addUniqueAction(
`${ ACTION_PREFIX }-cart-add-item`,
NAMESPACE,
tracker.eventHandler( 'add_to_cart' )
);

addUniqueAction(
`${ ACTION_PREFIX }-cart-remove-item`,
NAMESPACE,
tracker.eventHandler( 'remove_from_cart' )
);

addUniqueAction(
`${ ACTION_PREFIX }-checkout-render-checkout-form`,
NAMESPACE,
tracker.eventHandler( 'begin_checkout' )
);

addUniqueAction(
`${ ACTION_PREFIX }-product-view-link`,
NAMESPACE,
tracker.eventHandler( 'select_content' )
);

/**
* Remove additional actions added by WooCommerce Core which are either
* not supported by Google Analytics for WooCommerce or are redundant
* since Google retired Universal Analytics.
*/
removeAction( `${ ACTION_PREFIX }-checkout-submit`, NAMESPACE );
removeAction( `${ ACTION_PREFIX }-checkout-set-email-address`, NAMESPACE );
removeAction( `${ ACTION_PREFIX }-checkout-set-phone-number`, NAMESPACE );
removeAction( `${ ACTION_PREFIX }-checkout-set-billing-address`, NAMESPACE );
removeAction( `${ ACTION_PREFIX }-cart-set-item-quantity`, NAMESPACE );
removeAction( `${ ACTION_PREFIX }-product-search`, NAMESPACE );
removeAction( `${ ACTION_PREFIX }-store-notice-create`, NAMESPACE );
Loading
Loading