API
1 week ago
AdminDashboard
1 week ago
AdminNotices
1 week ago
AdminTexts
3 years ago
Attributes
1 week ago
Block
1 week ago
CLI
5 years ago
COT
1 week ago
CacheInvalidate
1 week ago
Container
1 week ago
Coupons
1 week ago
DisplayAsTranslated
1 week ago
DownloadableFiles
1 week ago
EditorScopedSync
1 week ago
Email
1 week ago
Endpoints
1 week ago
Exporter
1 week ago
HomeScreen
1 month ago
Importer
1 week ago
MO
1 week ago
Multicurrency
1 week ago
Options
1 week ago
OrderItems
1 week ago
Orders
1 week ago
PaymentGateways
1 week ago
Permalinks
1 week ago
PointerUi
1 week ago
PostHog
1 month ago
Reports
1 week ago
Rest
1 week ago
Reviews
1 week ago
RewriteRules
1 week ago
StandAlone
1 week ago
Synchronization
1 week ago
TMDashboard
1 week ago
Tax
1 week ago
Terms
1 week ago
TranslationControls
1 week ago
TranslationJob
1 week ago
User
1 week ago
Utilities
1 week ago
WcEmailSettings
1 week ago
currencies
1 week ago
media
1 week ago
multi-currency
1 week ago
order-property-filter
1 week ago
pointers
1 week ago
privacy
1 week ago
product
1 week ago
shortcodes
1 week ago
taxonomy-translation
1 week ago
templates
1 week ago
url-filters
1 week ago
urls
1 week ago
wcml-setup
1 week ago
class-wcml-admin-cookie.php
1 week ago
class-wcml-tracking-link.php
1 week ago
class-woocommerce-wpml.php
1 week ago
class-wcml-tracking-link.php
134 lines
| 1 | <?php |
| 2 | |
| 3 | class WCML_Tracking_Link { |
| 4 | |
| 5 | const WPML_HOME = 'https://wpml.org/'; |
| 6 | const WPML_ST_FAQ = 'https://wpml.org/faq/how-to-add-string-translation-to-your-site/'; |
| 7 | const WPML_PURCHASE = 'https://wpml.org/purchase/'; |
| 8 | const WPML_SUPPORT = 'https://wpml.org/forums/forum/english-support/'; |
| 9 | const WPML_ACCOUNT = 'https://wpml.org/shop/account/'; |
| 10 | const WPML_AUTO_TRANSLATION_DOC = 'https://wpml.org/documentation/automatic-translation/'; |
| 11 | |
| 12 | const WCML_MAIN_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/'; |
| 13 | const WCML_MULTI_CURRENCY_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/'; |
| 14 | const WCML_CLEAR_CART_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/clearing-cart-contents-when-language-or-currency-change/'; |
| 15 | const WCML_DISPLAY_AS_TRANSLATED_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/displaying-untranslated-products-in-secondary-languages/'; |
| 16 | const WCML_TRANSLATE_EMAILS_DOC = 'https://wpml.org/documentation/related-projects/woocommerce-multilingual/how-to-translate-woocommerce'; |
| 17 | const WCML_TRANSLATE_EMAILS_CAMPAIGN = 'woocommerce-emails'; |
| 18 | |
| 19 | const WCML_BOOKINGS_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-bookings-woocommerce-multilingual/'; |
| 20 | const WCML_BOOKINGS_CAMPAIGN = 'woocommerce-bookings'; |
| 21 | const WCML_PRODUCT_ADDONS_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-product-add-ons-woocommerce-multilingual/'; |
| 22 | const WCML_PRODUCT_ADDONS_CAMPAIGN = 'woocommerce-product-addons'; |
| 23 | const WCML_TAB_MANAGER_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-tab-manager-woocommerce-multilingual/'; |
| 24 | const WCML_TAB_MANAGER_CAMPAIGN = 'woocommerce-tab-manager'; |
| 25 | const WCML_TABLE_RATE_SHIPPING_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-table-rate-shipping-woocommerce-multilingual/'; |
| 26 | const WCML_TABLE_RATE_SHIPPING_CAMPAIGN = 'woocommerce-table-rate-shipping'; |
| 27 | const WCML_SUBSCRIPTIONS_DOC = 'https://wpml.org/documentation/woocommerce-extensions-compatibility/translating-woocommerce-subscriptions-woocommerce-multilingual/'; |
| 28 | const WCML_SUBSCRIPTIONS_CAMPAIGN = 'woocommerce-product-subscriptions'; |
| 29 | const WCML_CUSTOM_PRODUCT_TABS_DOC = 'https://wpml.org/plugin/custom-product-tabs-for-woocommerce/'; |
| 30 | |
| 31 | const UTM_TERM_WIZARD = 'wcml-setup-wizard'; |
| 32 | |
| 33 | public static function generate( $link, $id = false, $params = [] ) { |
| 34 | $params = array_merge( [ |
| 35 | 'utm_source' => 'plugin', |
| 36 | 'utm_medium' => 'gui', |
| 37 | 'utm_campaign' => 'wcml', |
| 38 | ], $params ); |
| 39 | |
| 40 | $link = add_query_arg( $params, $link ); |
| 41 | |
| 42 | if ( $id ) { |
| 43 | $link .= $id; |
| 44 | } |
| 45 | |
| 46 | return $link; |
| 47 | } |
| 48 | |
| 49 | private static function getStandaloneParams( $isStandalone ) { |
| 50 | return $isStandalone ? [ 'utm_campaign' => 'wcml-standalone' ] : []; |
| 51 | } |
| 52 | |
| 53 | public static function getWpmlHome( $isStandalone = false ) { |
| 54 | return self::generate( self::WPML_HOME, false, self::getStandaloneParams( $isStandalone ) ); |
| 55 | } |
| 56 | |
| 57 | public static function getWpmlStFaq( $isStandalone = false ) { |
| 58 | return self::generate( self::WPML_ST_FAQ, false, self::getStandaloneParams( $isStandalone ) ); |
| 59 | } |
| 60 | |
| 61 | public static function getWpmlPurchase( $isStandalone = false ) { |
| 62 | return self::generate( self::WPML_PURCHASE, false, self::getStandaloneParams( $isStandalone ) ); |
| 63 | } |
| 64 | |
| 65 | public static function getWpmlSupport() { |
| 66 | return self::generate( self::WPML_SUPPORT ); |
| 67 | } |
| 68 | |
| 69 | public static function getWpmlAccount() { |
| 70 | return self::generate( self::WPML_ACCOUNT ); |
| 71 | } |
| 72 | |
| 73 | public static function getWpmlAutoTranslationDoc() { |
| 74 | return self::generate( self::WPML_AUTO_TRANSLATION_DOC ); |
| 75 | } |
| 76 | |
| 77 | public static function getWcmlMainDoc( $id = false, $params = [] ) { |
| 78 | return self::generate( self::WCML_MAIN_DOC, $id, $params ); |
| 79 | } |
| 80 | |
| 81 | public static function getWcmlMultiCurrencyDoc( $id = false, $params = [] ) { |
| 82 | return self::generate( self::WCML_MULTI_CURRENCY_DOC, $id, $params ); |
| 83 | } |
| 84 | |
| 85 | public static function getWcmlClearCartDoc() { |
| 86 | return self::generate( self::WCML_CLEAR_CART_DOC ); |
| 87 | } |
| 88 | |
| 89 | public static function getWcmlDisplayAsTranslatedDoc( $params = [] ) { |
| 90 | return self::generate( self::WCML_DISPLAY_AS_TRANSLATED_DOC, false, $params ); |
| 91 | } |
| 92 | |
| 93 | public static function getWcmlTranslateEmailsDoc() { |
| 94 | return self::generate( self::WCML_TRANSLATE_EMAILS_DOC, false, [ |
| 95 | 'utm_campaign' => self::WCML_TRANSLATE_EMAILS_CAMPAIGN, |
| 96 | ] ) . '#translate-woocommerce-emails'; |
| 97 | } |
| 98 | |
| 99 | public static function getWcmlBookingsDoc() { |
| 100 | return self::generate( self::WCML_BOOKINGS_DOC, false, [ |
| 101 | 'utm_campaign' => self::WCML_BOOKINGS_CAMPAIGN, |
| 102 | ] ); |
| 103 | } |
| 104 | |
| 105 | public static function getWcmlProductAddonsDoc() { |
| 106 | return self::generate( self::WCML_PRODUCT_ADDONS_DOC, false, [ |
| 107 | 'utm_campaign' => self::WCML_PRODUCT_ADDONS_CAMPAIGN, |
| 108 | ] ); |
| 109 | } |
| 110 | |
| 111 | public static function getWcmlTabManagerDoc() { |
| 112 | return self::generate( self::WCML_TAB_MANAGER_DOC, false, [ |
| 113 | 'utm_campaign' => self::WCML_TAB_MANAGER_CAMPAIGN, |
| 114 | ] ); |
| 115 | } |
| 116 | |
| 117 | public static function getWcmlTableRateShippingDoc() { |
| 118 | return self::generate( self::WCML_TABLE_RATE_SHIPPING_DOC, false, [ |
| 119 | 'utm_campaign' => self::WCML_TABLE_RATE_SHIPPING_CAMPAIGN, |
| 120 | ] ); |
| 121 | } |
| 122 | |
| 123 | public static function getWcmlSubscriptionsDoc() { |
| 124 | return self::generate( self::WCML_SUBSCRIPTIONS_DOC, false, [ |
| 125 | 'utm_campaign' => self::WCML_SUBSCRIPTIONS_CAMPAIGN, |
| 126 | ] ); |
| 127 | } |
| 128 | |
| 129 | public static function getWcmlCustomProductTabs() { |
| 130 | return self::generate( self::WCML_CUSTOM_PRODUCT_TABS_DOC ); |
| 131 | } |
| 132 | |
| 133 | } |
| 134 |