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

Tag the WooCommerce Analytics tracking script so that it can be disabled if visitors refuse cookies #13039

Closed
dericleeyy opened this issue Jul 12, 2019 · 10 comments
Assignees
Labels
Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" [Feature] WooCommerce Analytics [Focus] GDPR [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@dericleeyy
Copy link

dericleeyy commented Jul 12, 2019

Is your feature request related to a problem? Please describe.

Jetpack WooCommerce Analytics script is not tagged to disable tracking if users refuse cookies, ie through Cookiebot's Cookie consent banner.

Describe the solution you'd like

Example, The line that says:

<script async src='https://stats.wp.com/s-<id>.js <https://stats.wp.com/s-<id>.js>'>

Needs to be modified so it will look like this:

<script async src='https://stats.wp.com/s-<id>.js <https://stats.wp.com/s-<id>.js>' type="text/plain" data-cookieconsent="marketing">

Describe alternatives you've considered

Provide an option to refuse cookies and still use the site.

Additional context

Requested from 2165741-zen

@dericleeyy dericleeyy added [Focus] GDPR [Feature] Stats Data Feature that enables users to track their site's traffic and gain insights on popular content. labels Jul 12, 2019
@matticbot matticbot added the Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" label Jul 12, 2019
@jeherve jeherve added [Feature] WooCommerce Analytics [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Feature] Stats Data Feature that enables users to track their site's traffic and gain insights on popular content. labels Jul 12, 2019
@jeherve jeherve changed the title Tag the stats tracking script so that it can be disabled if visitors refuse cookies Tag the WooCommerce Analytics tracking script so that it can be disabled if visitors refuse cookies Jul 12, 2019
jeherve added a commit that referenced this issue Aug 2, 2019
Related: #13039

For third-parties to be able to interact with our tracking script, it is easier if it is registered using core WP functions instead of just added to wp_head.

Using wp_enqueue_script makes it easier to dequeue the file if needed, or modify its output with the script_loader_tag filter (one could add an async parameter for example, or add extra data attributes like the Cookiebot plugin.
@jeherve
Copy link
Member

jeherve commented Aug 2, 2019

I looked into this, and I believe this is something that needs to be implemented within the Cookiebot plugin directly, here:
https://github.com/CybotAS/CookiebotWP/blob/d08bb2fdbe79433e63d5a41883aba0fe782ae0dc/addons/controller/addons/jetpack/jetpack.php

The Cookiebot plugin includes the Script_Loader_Tag_Interface that can be used to add extra data attributes to any enqueued files, to mark them as marketing resources for example:
https://github.com/CybotAS/CookiebotWP/blob/8af3203a0496a3302d8c4e922bf166760524cd80/addons/lib/script-loader-tag/script-loader-tag.php#L23

However, for Cookiebot to be able to do that, we need to make a few changes to the way we add the file to sites in the first place. This will happen in #13173.

Once that's merged, we can file an issue with the Cookiebot team to let them know about it.

@jeherve jeherve self-assigned this Aug 2, 2019
dereksmart pushed a commit that referenced this issue Aug 15, 2019
* Woo Analytics: use core WP function to enqueue script

Related: #13039

For third-parties to be able to interact with our tracking script, it is easier if it is registered using core WP functions instead of just added to wp_head.

Using wp_enqueue_script makes it easier to dequeue the file if needed, or modify its output with the script_loader_tag filter (one could add an async parameter for example, or add extra data attributes like the Cookiebot plugin.

* Add utility allowing us to load some of our scripts asynchronously

See #13173 (comment)
@stale
Copy link

stale bot commented Jan 30, 2020

This issue has been marked as stale. This happened because:

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

@stale stale bot added the [Status] Stale label Jan 30, 2020
@getsnoopy
Copy link

Why does that script exist? And why is it contacting wp.com? Can it be disabled?

@stale stale bot removed the [Status] Stale label Mar 26, 2020
@jeherve
Copy link
Member

jeherve commented Mar 26, 2020

@getsnoopy You can find out more about the feature and how it works in the Pull Request where it was introduced: #8296

It can be disabled if you are not interested in the feature. To do so, you can add the following snippet to a functionality plugin on your site:

/**
 * Never load Jetpack's WooCommerce Analytics tool.
 *
 * @param array $tools Array of additional tools loaded by Jetpack.
 */
function jetpackcom_no_woo_analytics( $tools ) {
    $index = array_search( 'woocommerce-analytics/wp-woocommerce-analytics.php', $tools );
    if ( false !== $index ) {
        unset( $tools[ $index ] );
    }
    return $tools;
}
add_filter( 'jetpack_tools_to_include', 'jetpackcom_no_woo_analytics' );

@getsnoopy
Copy link

Thanks. This feature should really be able to be disabled via the Jetpack modules page. It seems like there are many people on the web who have been trying to get rid of it to no avail

@jeherve
Copy link
Member

jeherve commented Mar 26, 2020

@getsnoopy That's a good point, and definitely something worth considering. I'll add this to our to-do list for our next iteration on the feature.

@jeherve
Copy link
Member

jeherve commented Mar 31, 2020

@getsnoopy In #15187, I have now made the feature a module that can disabled from this screen in your dashboard:
wp-admin/admin.php?page=jetpack_modules

You can consequently get rid of that code snippet above and disable the module when Jetpack 8.4 is released.

@getsnoopy
Copy link

@jeherve Quite the quick turnaround. Cheers!

@stale
Copy link

stale bot commented Oct 4, 2020

This issue has been marked as stale. This happened because:

  • It has been inactive in the past 6 months.
  • It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`.

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

@stale stale bot added the [Status] Stale label Oct 4, 2020
@jeherve
Copy link
Member

jeherve commented Oct 5, 2020

Closing this now, since we've implemented #13173 to allow third-party plugins to customize that script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" [Feature] WooCommerce Analytics [Focus] GDPR [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

No branches or pull requests

5 participants