diff --git a/assets/src/dashboard/parts/connected/help/index.js b/assets/src/dashboard/parts/connected/help/index.js
index 3effea673..83cbba613 100644
--- a/assets/src/dashboard/parts/connected/help/index.js
+++ b/assets/src/dashboard/parts/connected/help/index.js
@@ -45,15 +45,15 @@ const DOCS_SECTION = [
items: [
{
label: optimoleDashboardApp.strings.help.account_item_one,
- value: 'https://docs.optimole.com/article/1134-how-optimole-counts-the-number-of-visitors'
+ value: optimoleDashboardApp.docs_links.visitors_count
},
{
label: optimoleDashboardApp.strings.help.account_item_two,
- value: 'https://docs.optimole.com/article/1008-what-happens-if-i-exceed-plan-limits'
+ value: optimoleDashboardApp.docs_links.plan_limits
},
{
label: optimoleDashboardApp.strings.help.account_item_three,
- value: 'https://docs.optimole.com/article/1133-visitors-based-plan'
+ value: optimoleDashboardApp.docs_links.visitors_plan
}
]
},
@@ -62,15 +62,15 @@ const DOCS_SECTION = [
items: [
{
label: optimoleDashboardApp.strings.help.image_processing_item_one,
- value: 'https://docs.optimole.com/article/1173-how-to-get-started-with-optimole-in-just-3-steps'
+ value: optimoleDashboardApp.docs_links.getting_started
},
{
label: optimoleDashboardApp.strings.help.image_processing_item_two,
- value: 'https://docs.optimole.com/article/1068-how-optimole-can-serve-webp-images'
+ value: optimoleDashboardApp.docs_links.webp
},
{
label: optimoleDashboardApp.strings.help.image_processing_item_three,
- value: 'https://docs.optimole.com/article/1475-adding-watermarks-to-your-images'
+ value: optimoleDashboardApp.docs_links.watermarks
}
]
},
@@ -79,15 +79,15 @@ const DOCS_SECTION = [
items: [
{
label: optimoleDashboardApp.strings.help.api_item_one,
- value: 'https://docs.optimole.com/article/1323-cloud-library-browsing'
+ value: optimoleDashboardApp.docs_links.cloud_library
},
{
label: optimoleDashboardApp.strings.help.api_item_two,
- value: 'https://docs.optimole.com/article/1191-exclude-from-optimizing-or-lazy-loading'
+ value: optimoleDashboardApp.docs_links.exclusions
},
{
label: optimoleDashboardApp.strings.help.api_item_three,
- value: 'https://docs.optimole.com/article/1307-custom-integration'
+ value: optimoleDashboardApp.docs_links.custom_integration
}
]
}
@@ -134,7 +134,7 @@ const Help = () => {
{ optimoleDashboardApp.strings.help.section_two_title }
-
{ optimoleDashboardApp.strings.help.section_two_sub }
+
{ optimoleDashboardApp.strings.help.section_two_sub }
diff --git a/assets/src/dashboard/parts/connected/settings/Watermark.js b/assets/src/dashboard/parts/connected/settings/Watermark.js
index e42000a24..7e0efb54b 100644
--- a/assets/src/dashboard/parts/connected/settings/Watermark.js
+++ b/assets/src/dashboard/parts/connected/settings/Watermark.js
@@ -63,7 +63,7 @@ const Watermark = () => {
className="border border-gray-300 text-gray-700 px-6 py-3 rounded-lg font-medium hover:bg-gray-50"
target="_blank"
rel="noopener noreferrer"
- href="https://docs.optimole.com/article/1475-adding-watermarks-to-your-images"
+ href={ optimoleDashboardApp.docs_links.watermark_settings }
>
{options_strings.learn_more}
diff --git a/assets/src/global.d.ts b/assets/src/global.d.ts
index 541e9aeac..1b1163189 100644
--- a/assets/src/global.d.ts
+++ b/assets/src/global.d.ts
@@ -27,6 +27,7 @@ export interface IOptimoleDashboardApp {
optimoleHome: string
optimoleDashHome: string
optimoleDashBilling: string
+ docs_links: DocsLinks
days_since_install: string
is_offload_media_available: string
auto_connect: string
@@ -38,6 +39,20 @@ export interface IOptimoleDashboardApp {
report_issue_url: string
}
+export interface DocsLinks {
+ home: string
+ visitors_count: string
+ plan_limits: string
+ visitors_plan: string
+ getting_started: string
+ webp: string
+ watermarks: string
+ cloud_library: string
+ exclusions: string
+ custom_integration: string
+ watermark_settings: string
+}
+
export interface Strings {
optimole: string
version: string
diff --git a/inc/admin.php b/inc/admin.php
index 4438d099a..0ebf66c64 100755
--- a/inc/admin.php
+++ b/inc/admin.php
@@ -788,6 +788,42 @@ public static function get_upgrade_base_link() {
return $base_url;
}
+ /**
+ * Build a docs.optimole.com link with UTMs.
+ *
+ * Links go to the final docs URL: the old /article/ URLs redirect, and the redirect drops the UTMs.
+ *
+ * @param string $path Docs page path, e.g. 'wordpress-plugin/best-format'.
+ * @param string $campaign The feature the link explains (utm_campaign).
+ * @param string $medium Where the link is shown (utm_medium).
+ *
+ * @return string Docs URL with UTMs.
+ */
+ public static function docs_url( $path, $campaign, $medium ) {
+ return tsdk_utmify( 'https://docs.optimole.com/' . ltrim( $path, '/' ), $campaign, $medium );
+ }
+
+ /**
+ * Get docs links used by the dashboard app.
+ *
+ * @return array
Docs URLs with UTMs, by key.
+ */
+ public static function get_dashboard_docs_links() {
+ return [
+ 'home' => self::docs_url( '', 'documentation', 'help' ),
+ 'visitors_count' => self::docs_url( 'account/how-optimole-counts-the-number-of-visitors', 'visitors-count', 'help' ),
+ 'plan_limits' => self::docs_url( 'account/what-happens-if-i-exceed-plan-limits', 'plan-limits', 'help' ),
+ 'visitors_plan' => self::docs_url( 'account/visitors-based-plan', 'visitors-plan', 'help' ),
+ 'getting_started' => self::docs_url( 'wordpress-plugin/how-to-get-started-with-optimole-in-just-3-steps', 'getting-started', 'help' ),
+ 'webp' => self::docs_url( 'image-processing/how-optimole-can-serve-webp-images', 'webp', 'help' ),
+ 'watermarks' => self::docs_url( 'image-processing/adding-watermarks-to-your-images', 'watermark', 'help' ),
+ 'cloud_library' => self::docs_url( 'wordpress-plugin/cloud-library-browsing', 'cloud-library', 'help' ),
+ 'exclusions' => self::docs_url( 'wordpress-plugin/exclude-from-optimizing-or-lazy-loading', 'exclusions', 'help' ),
+ 'custom_integration' => self::docs_url( 'image-processing/how-to-use-the-custom-integration-in-optimole', 'custom-integration', 'help' ),
+ 'watermark_settings' => self::docs_url( 'image-processing/adding-watermarks-to-your-images', 'watermark', 'settings' ),
+ ];
+ }
+
/**
* Get contact URL.
*
@@ -1538,6 +1574,7 @@ private function localize_dashboard_app() {
'optimoleDashBilling' => tsdk_translate_link( 'https://dashboard.optimole.com/settings/billing', 'query' ),
'optimoleDashMetrics' => tsdk_translate_link( tsdk_utmify( 'https://dashboard.optimole.com/metrics', 'wp-plugin', 'shortcut' ) ),
'offload_upgrade_url' => tsdk_translate_link( tsdk_utmify( 'https://optimole.com/pricing/', 'offload' ) ),
+ 'docs_links' => self::get_dashboard_docs_links(),
'days_since_install' => round( ( time() - get_option( 'optimole_wp_install', 0 ) ) / DAY_IN_SECONDS ),
'is_offload_media_available' => $is_offload_media_available,
'auto_connect' => $auto_connect,
@@ -1866,13 +1903,13 @@ private function get_dashboard_strings() {
'',
'',
number_format_i18n( 2000 ),
- '',
+ '',
''
),
'account_needed_subtitle_3' => sprintf(
/* translators: 1 is the starting anchor tag for the docs link, 2 is the ending anchor tag. */
__( 'Need help? %1$sGetting Started with Optimole%2$s', 'optimole-wp' ),
- '',
+ '',
''
),
'account_needed_subtitle_2' => sprintf(
@@ -2016,7 +2053,7 @@ private function get_dashboard_strings() {
'best_format_desc' => sprintf(
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
__( 'When enabled, Optimole chooses the best format for your images, balancing quality with speed. It tries options like AVIF and WebP to keep visuals sharp and pages fast, though uncached images may take a bit longer to process. %1$sLearn more%2$s.', 'optimole-wp' ),
- '',
+ '',
''
),
'add_filter' => __( 'Add filter', 'optimole-wp' ),
@@ -2026,7 +2063,7 @@ private function get_dashboard_strings() {
'cache_desc' => sprintf(
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
__( 'Clears all Optimole’s cached resources (images, JS, CSS). Useful if you made changes to your images and don\'t see those applying on your site. %1$sLearn more%2$s', 'optimole-wp' ),
- '',
+ '',
''
),
'cache_title' => __( 'Clear Cached Resources', 'optimole-wp' ),
@@ -2034,7 +2071,7 @@ private function get_dashboard_strings() {
'image_size_notice' => sprintf(
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
__( 'Use this option if you notice images are not cropped correctly after using Optimole. Add the affected image sizes here to automatically adjust and correct their cropping for optimal display. %1$sLearn more%2$s', 'optimole-wp' ),
- '',
+ '',
''
),
'clear_cache_images' => __( 'Clear cached images', 'optimole-wp' ),
@@ -2048,13 +2085,13 @@ private function get_dashboard_strings() {
'enable_avif_desc' => sprintf(
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
__( 'Enable this to automatically convert images to the AVIF format on browsers that support it. This format provides quality images with reduced file sizes, and faster webpage loading. %1$sLearn more%2$s', 'optimole-wp' ),
- '',
+ '',
''
),
'enable_bg_lazyload_desc' => sprintf(
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
__( 'Apply lazy loading to CSS background images. The toggle below enables it globally. The selector list is optional and only needed to extend coverage if certain elements are missed. %1$sLearn more%2$s', 'optimole-wp' ),
- '',
+ '',
''
),
'enable_bg_lazyload_title' => __( 'CSS Background Lazy Load', 'optimole-wp' ),
@@ -2063,26 +2100,26 @@ private function get_dashboard_strings() {
'enable_noscript_desc' => sprintf(
/* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */
__( 'Enables fallback images for browsers that can\'t handle JavaScript-based lazy loading or related features. Disabling it may resolve conflicts with other plugins or configurations and decrease HTML page size. %1$sLearn more%2$s', 'optimole-wp' ),
- '',
+ '',
''
),
// translators: %s is the name of the html tag (e.g: