Skip to content

Commit

Permalink
Merge pull request #322 from woocommerce/remove-universal-analytics
Browse files Browse the repository at this point in the history
Remove Universal Analytics
  • Loading branch information
martynmjones authored Mar 4, 2024
2 parents 5893e38 + b47bf99 commit d671856
Show file tree
Hide file tree
Showing 31 changed files with 1,375 additions and 2,435 deletions.
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
29 changes: 26 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

[![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)
Expand All @@ -14,7 +14,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 @@ -38,4 +38,27 @@ 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)

### Consent Mode

The extension sets up [the default state of consent mode](https://developers.google.com/tag-platform/security/guides/consent?hl=en&consentmode=advanced#default-consent), denying all parameters for the EEA region. You can append or overwrite that configuration using the following snippet:

```php
add_action( 'wp_enqueue_scripts', function () {
$customConsentConfig = "
gtag( 'consent', 'default', {
analytics_storage: 'granted',
ad_storage: 'granted',
ad_user_data: 'denied',
ad_personalization: 'denied',
region: 'ES',
} );";

wp_register_script( 'my-custom-consent-mode', '', array('woocommerce-google-analytics-integration'), null, false );
wp_add_inline_script( 'my-custom-consent-mode', $customConsentConfig );
wp_enqueue_script( 'my-custom-consent-mode' );
} );
```

After the page loads, the consent for particular parameters can be updated by other plugins or custom code, implementing UI for customer-facing configuration using [Google's consent API](https://developers.google.com/tag-platform/security/guides/consent?hl=en&consentmode=advanced#update-consent) (`gtag('consent', 'update', {…})`).
198 changes: 0 additions & 198 deletions assets/js/src/actions.js

This file was deleted.

44 changes: 0 additions & 44 deletions assets/js/src/admin-ga-settings.js

This file was deleted.

36 changes: 36 additions & 0 deletions assets/js/src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* global wcgai */
export const config = wcgai.config;
export const EEARegions = [
'AT',
'BE',
'BG',
'HR',
'CY',
'CZ',
'DK',
'EE',
'FI',
'FR',
'DE',
'GR',
'HU',
'IS',
'IE',
'IT',
'LV',
'LI',
'LT',
'LU',
'MT',
'NL',
'NO',
'PL',
'PT',
'RO',
'SK',
'SI',
'ES',
'SE',
'GB',
'CH',
];
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 { trackClassicPages } from './integrations/classic';
window.wcgai.trackClassicPages = trackClassicPages;

// Initialize tracking for Block based WooCommerce pages
import './integrations/blocks';
Loading

0 comments on commit d671856

Please sign in to comment.