Skip to content

fix: point docs links to current pages and track them with UTMs - #1404

Merged
poonam279 merged 2 commits into
developmentfrom
fix/docs-links-utm
Nov 9, 2026
Merged

poonam279 merged 2 commits into
developmentfrom
fix/docs-links-utm

Conversation

@poonam279

Copy link
Copy Markdown

Summary

This is part of Codeinwp/docs-site#1596 (reviewing docs links in all products). Visualizer links to the docs from the chart editor, the Plugins page and the Support page. Twelve of the links use old HelpScout addresses on docs.themeisle.com (/article/728-manual-configuration, /category/657-visualizer, …). They reach the right page through a redirect, but the redirect drops the query string. None of the docs links send UTM parameters anyway, so docs visits from the plugin aren't attributed in analytics.

This PR:

  • Points every docs link straight at its current page under docs.themeisle.com/visualizer-charts-and-graphs/ (no redirect). This includes the URL constants in index.php (VISUALIZER_DB_QUERY_DOC_URL, VISUALIZER_MAIN_DOC, VISUALIZER_CODE_SNIPPETS_URL) and their copies in the static-analysis stubs.
  • Wraps each link in the SDK's tsdk_utmify() and esc_url() where it's printed. The constants stay plain URLs, so each place that shows VISUALIZER_MAIN_DOC gets its own values.
  • For the three Pro upsell boxes (permissions, WordPress posts, database), passes the tracked URL to the visualizer_pro_upsell filter, which already escapes it.
  • Moves the URL out of the translatable "Import from JSON" description. It now uses %1$s/%2$s placeholders like the other descriptions in Layout.php.

Links changed

Where it's shown Page (under docs.themeisle.com/visualizer-charts-and-graphs/) utm_medium utm_campaign
Chart editor → Help: Main documentation page (docs hub) chart-editor documentation
Chart editor → Help: Custom code snippets (docs hub) chart-editor code-snippets
Chart editor → Help: Articles containing "" (docs hub, ?query=<type>) chart-editor chart-type-articles
Chart editor → Source: Google Spreadsheet / Import from JSON how-can-i-populate-data-from-google-spreadsheet, how-to-generate-charts-from-json-data-rest-endpoints chart-editor google-sheets, json-data
Chart editor → Source: JSON endpoint headers note visualizer-how-to-extend-rest-endpoints-with-json-response chart-editor rest-endpoints
Chart editor → Source: Database sample queries visualizer-sample-queries-to-generate-charts chart-editor sample-queries
Chart editor → Pro upsells: Documentation button how-to-customize-permissions, how-to-create-charts-from-your-wordpress-posts, how-to-generate-charts-from-the-database chart-editor chart-permissions, wordpress-posts, database-query
Chart editor → Settings: Manual configuration "Common Snippets" (Google and ChartJS) manual-configuration chart-editor manual-configuration
Chart editor → Series settings: role examples roles-for-series-visualizer chart-editor series-roles
Plugins page → Visualizer row: Docs (docs hub) pluginrow documentation
Support page → Documentation (docs hub), create-chart support-page documentation, create-chart

The record of current vs new parameters for every product is in the docs-links report: https://claude.ai/artifact/TFrbebxm6kHNpJfb7GfzR2

Not changed, for the team to decide

  • "Articles containing ''" (VISUALIZER_DOC_COLLECTION) adds ?query=<type> to the docs hub. The docs site doesn't read that parameter, so the link opens the hub without a search. It works and is now tracked. Renaming the link or pointing it elsewhere is a product decision.
  • "Custom code snippets" used to open a HelpScout category that no longer exists. It now opens the docs hub, the same page the old address redirected to.

Will affect visual aspect of the product

NO. Only the link addresses change.

Test instructions

  • Open a chart in the editor and open the Help tab. Click "Main documentation page", "Custom code snippets" and "Articles containing …". Each should open the Visualizer docs with utm_source=wpadmin in the address bar.
  • In the chart's data source panel, click the Google Spreadsheet, JSON tutorial, JSON headers and database sample-query links. On the free plan, click Documentation in the Permissions, WordPress and Database upsell boxes.
  • In Settings → Manual configuration, click "Common Snippets". In a series' settings, click the second "here" (role examples).
  • On Plugins, click Docs under Visualizer (shown when Visualizer Pro isn't installed). On the Visualizer Support page, click both links in the Documentation section.

Testing done

  • phpcs and phpstan report the same findings on the changed files before and after (none new).
  • Ran the SDK's tsdk_utmify() on every new link: each returns 200 on docs.themeisle.com with no redirect, and the UTM parameters stay in the URL.

Part of Codeinwp/docs-site#1596.

🤖 Generated with Claude Code

@pirate-bot

pirate-bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Plugin build for a7af6d1 is ready 🛎️!

@poonam279
poonam279 requested a review from pirate-bot November 3, 2026 10:12

@pirate-bot pirate-bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

QA check: The code checks found no defect, but nobody clicked the new docs links in a running site.

Validation details
  • Files reviewed: 8/8 changed files.
  • tsdk_utmify( $url, $area, $location ) exists in the locked themeisle-sdk 3.3.69. Every new call uses that argument order.
  • add_query_arg keeps the existing ?query=<type> on the chart-type link.
  • The Pro upsell filter callback prints the URL with esc_url.
  • The three changed constants match the static-analysis stubs.
  • These checks read source only. No code ran.
QA steps
  1. Open a chart in the editor, then open the Help tab. Click "Main documentation page", "Custom code snippets" and "Articles containing …". Each link opens the Visualizer docs, and the address bar shows utm_source=wpadmin.
  2. In the data source panel, click the Google Spreadsheet link, the JSON tutorial link, the JSON headers link and the database sample-query link. Each opens its docs page with UTM values in the address.
  3. On the free plan, click Documentation in the Permissions, WordPress and Database upsell boxes. Each opens its docs page.
  4. Go to Settings, then Manual configuration, and click "Common Snippets" on a Google chart and on a ChartJS chart. Each opens the manual configuration page.
  5. In a series' settings, click the second "here" link. The series roles page opens.
  6. On the Plugins page, click Docs under Visualizer. On the Visualizer Support page, click both Documentation links. Each opens the docs with UTM values.
  7. With a non-English site language, open Import from JSON. Check that the description shows a working "this" link.
Untested areas
  • No browser check ran, because no site was set up.
  • The SDK is not installed locally, so the tsdk_utmify output was not run.
  • The Pro add-on is outside the repository. Its use of the upsell URL is unverified.

🤖 Automated review · run code-review-agent_6ae9b37a3548e5.84968643.


🤖 Review agent — review posted ✅ on 93b02aae · commented · 0 findings · 10 min

Run code-review-agent_6ae9b37a3548e5.84968643 · trail

@poonam279

Copy link
Copy Markdown
Author

Tested build 93b02aa (4.0.10-dev.ce0354d) on Visualizer 4.0.8 (free).

✅ The Plugins row "Docs", the Support page links, the chart editor's Documentation group, the data source links (Google Spreadsheet, JSON, JSON headers, DB sample queries), the WordPress/Database/Permissions "Documentation" buttons and the series role link all point to /visualizer-charts-and-graphs/ pages with UTMs. Each returns 200 with no redirect.

❌ ChartJS chart → Manual Configuration → "Common Snippets" now opens a 404.

The server sends the right URL:
https://docs.themeisle.com/visualizer-charts-and-graphs/manual-configuration?utm_source=wpadmin&utm_medium=chart-editor&...

But the editor shows:
https://docs.themeisle.com/visualizer-charts-and-graphs/manual-configurationlinechartutm_source=wpadmin&utm_medium=chart-editor&... → 404

Cause: js/frame.js:71 replaces the first ? in span.viz-gvlink with the chart type (meant for the Google API link .../gallery/?#configuration-options). The ChartJS description has no other ?, so the ? this PR adds for the UTMs gets replaced. On 4.0.8 the link (/article/728-manual-configuration) had no ?, so it worked.

Possible fix: apply the replace only to the Google API link, e.g. target span.viz-gvlink a[href*="developers.google.com"] and update its href.

frame.js replaced the first "?" in every span.viz-gvlink to put the chart
type into the Google API link. On ChartJS charts that "?" is the start of
the Common Snippets UTM query string, so the link became a 404. It also
copied the first span's HTML into all of them, so on Google charts the
Manual Configuration box showed the Data Filter text. Now only the Google
API link's href is updated. Adds e2e checks for both libraries.

Part of Codeinwp/docs-site#1596.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@poonam279

Copy link
Copy Markdown
Author

Fixed in a7af6d1: js/frame.js now updates only the Google API link (gallery/? → gallery/<type>chart) instead of replacing the first ? in every span.viz-gvlink. So the Common Snippets link keeps its UTM query string on ChartJS charts. This also fixes an older bug: the old code copied the first span's HTML into all of them, so on Google charts the Manual Configuration box showed the Data Filter text and its links were missing. Two new e2e tests in admin.spec.js (Google Charts and ChartJS) check both links. They pass with the fix and fail on the old code.

@poonam279
poonam279 requested a review from pirate-bot November 9, 2026 12:10

@pirate-bot pirate-bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes requested

The chart editor links now work and carry UTMs. Update the old docs addresses that both readme files still use.

  • readme.txt:22 — correctness readme.txt and readme.md still link the docs through 17 old HelpScout addresses each (line 22 /collection/1560-visualizer-charts-and-graphs, lines 168-227 /article/<n>-...). The PR says it points every docs link at its current page. These links still go through the redirect and carry no UTM values, so WordPress.org docs visits stay unattributed. Line 24 already tags a static link with utm_source=wordpressorg&utm_medium=readme. Replace each address in both files with its current docs.themeisle.com/visualizer-charts-and-graphs/... page. Add literal UTM values for the readme origin, like line 24.
Validation details
  • Files reviewed: 10/10 changed files.
  • The new e2e spec passes at HEAD in a local WordPress site with Chromium cd /repo && export WP_BASE_URL=http://localhost:8080 WP_USERNAME=admin WP_PASSWORD=admin WP_ARTIFACTS_PATH=/workspace/ch… printed 2 passed (run R18).
  • The same spec fails with the old js/frame.js [R19] and at pr-base [R20]. It detects the change.
  • The rendered hrefs were captured on the Plugins page, the Support page, and the Google and ChartJS editors [R27] [R29] [R30] [R34]. Each one matches the PR table, and none is double-escaped.
  • The prior run code-review-agent_6ae9b37a3548e5.84968643 checked the tsdk_utmify signature and the upsell escaping in source. These checks were not rerun.
Untested areas
  • Only the pie chart ran through the chart type link rewrite in a browser.
  • The editor after Create Chart was not captured.
  • The Pro add-on use of the upsell URL is outside the repository.

🤖 Automated review · run code-review-agent_6af1b84a009682.12408533.


🤖 Review agent — review posted ✅ on a7af6d17 · changes requested · 1 finding · 14 min

Run code-review-agent_6af1b84a009682.12408533 · trail

@poonam279
poonam279 merged commit dfa6aef into development Nov 9, 2026
10 checks passed
@poonam279
poonam279 deleted the fix/docs-links-utm branch November 9, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants