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

[WooCommerce Analytics] Add clickhouse param to record events in w.gif #41476

Open
wants to merge 6 commits into
base: release/woocommerce-analytics-0.4.2
Choose a base branch
from

Conversation

puntope
Copy link
Contributor

@puntope puntope commented Jan 31, 2025

Fixes #

Proposed changes:

  • This PR adds a clickhouse param 'ch' to the woocommerceanalytics events so the Analytics library can fetch w.gif and send the data to ClickHouse as well.

This PR needs to be tested in parallel with https://github.com/Automattic/analytics/pull/76

Screenshot 2025-01-31 at 19 32 01

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Perform setup instructions in https://github.com/Automattic/analytics/pull/76 to test this PR.
  • Perform some events For example Product Views. And verify t.gif and w.gif are loaded without woocommerceanalytics_ prefix on the event name in w.gif but yes in t.gif
  • Perform some events For example My Account View. And verify only t.gif is loaded with the woocommerceanalytics_ prefix on the event name.

Copy link
Contributor

github-actions bot commented Jan 31, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the add/clickhouse-param branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/clickhouse-param
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

Copy link
Contributor

github-actions bot commented Jan 31, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jan 31, 2025
@puntope puntope changed the base branch from trunk to release/woocommerce-analytics-0.4.2 January 31, 2025 17:40
Copy link
Contributor

github-actions bot commented Jan 31, 2025

Code Coverage Summary

No summary data is avilable for parent commit 31a4490, cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for 31a4490 is available.

Full summary · PHP report · JS report

@puntope puntope requested review from ianlin and mikkamp January 31, 2025 18:49
@puntope puntope marked this pull request as ready for review January 31, 2025 18:50
@jeherve jeherve added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Pri] Normal and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 3, 2025
Copy link
Member

@ianlin ianlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on adding w.gif for ClickHouse.

verify t.gif and w.gif are loaded without woocommerceanalytics_ prefix on the event name in w.gif but yes in t.gif

I think you meant the parameter _en should include the prefix or not, right?

I saw both w.gif and t.gif's _en param still contain the prefix, do we need to add that logic in this package in favour of this discussion https://github.com/Automattic/analytics/pull/76#discussion_r1937616615?

Perform some events For example My Account View. And verify only t.gif is loaded

When I went to "My Account" page I didn't see t.gif was loaded, only g.gif. It's also true if I didn't apply the change from this PR.

@puntope
Copy link
Contributor Author

puntope commented Feb 4, 2025

I saw both w.gif and t.gif's _en param still contain the prefix, do we need to add that logic in this package in favour of this discussion https://github.com/Automattic/analytics/pull/76#discussion_r1937616615?

Let's see how the discussion ends.

…4.2' into add/clickhouse-param

# Conflicts:
#	projects/packages/woocommerce-analytics/src/class-woo-analytics-trait.php
@puntope
Copy link
Contributor Author

puntope commented Feb 6, 2025

When I went to "My Account" page I didn't see t.gif was loaded, only g.gif. It's also true if I didn't apply the change from this PR.

I don't know about g.gifonly t.gifshould be loaded y My Account.

What steps are you following?

Screenshot 2025-02-06 at 16 18 08

@ianlin
Copy link
Member

ianlin commented Feb 7, 2025

What steps are you following?

  1. Follow the step to build https://github.com/Automattic/analytics/pull/76
  2. Copy dist/s.js to my WPCOM sandbox's /home/wpcom/public_html/stats.dir/
  3. Point stats.wp.com to my sandbox IP in /etc/hosts
  4. Build Jetpack from this PR by running jetpack build plugins/jetpack
  5. Sync the jetpack plugin to my JN site by running jetpack rsync jetpack [email protected]:/srv/htdocs/wp-content/plugins/jetpack

Cart page ✅

w.gif, t.gif, and g.gif are loaded

Screenshot 2025-02-07 at 10 08 19

My Account page

Only g.gif is loaded

Screenshot 2025-02-07 at 10 07 58

I think maybe it's not related to this PR because when I used the real stats.wp.com instead of my sandbox, the t.gif was still not loaded in My Accounts page or the Home page.

@puntope
Copy link
Contributor Author

puntope commented Feb 7, 2025

Only g.gif is loaded

Don't know about that g.gif but are you logged in as a non admin?

@ianlin
Copy link
Member

ianlin commented Feb 7, 2025

are you logged in as a non admin?

Yeah, I opened an incognito window and did not log in any user.

@puntope
Copy link
Contributor Author

puntope commented Feb 7, 2025

are you logged in as a non admin?

Yeah, I opened an incognito window and did not log in any user.

It seems that is needed to have a logged in user to trigger my account page view event, just entering the URL that shows the register or login form won't trigger the event.

@ianlin
Copy link
Member

ianlin commented Feb 7, 2025

is needed to have a logged in user to trigger my account page view event

You're right, t.gif was loaded and g.gif wasn't loaded after I logged in as a normal user. 👍

@puntope
Copy link
Contributor Author

puntope commented Feb 8, 2025

@ianlin After discussions here https://github.com/Automattic/analytics/pull/76 and with systems we don't need to remove woocommerceanalytics_ we will have the events prefixed as well in CH.

So in brief all the events with 'ch=1' param in the query will be sent as well to CH.

THis is ready for a final round. Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WooCommerce Analytics [Package] WooCommerce Analytics Enhanced analytics for WooCommerce users [Pri] Normal [Status] In Progress [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants