diff --git a/classes/controllers/FrmAddonsController.php b/classes/controllers/FrmAddonsController.php index bf7361e710..83ff457689 100644 --- a/classes/controllers/FrmAddonsController.php +++ b/classes/controllers/FrmAddonsController.php @@ -839,12 +839,11 @@ protected static function prepare_addon_link( &$link ) { $link = $site_url . $link; } $link = FrmAppHelper::make_affiliate_url( $link ); - $query_args = array( - 'utm_source' => 'WordPress', - 'utm_medium' => 'addons', - 'utm_campaign' => 'liteplugin', + + $utm = array( + 'campaign' => 'addons', ); - $link = add_query_arg( $query_args, $link ); + $link = FrmAppHelper::maybe_add_missing_utm( $link, $utm ); } /** diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php index 139c5dfd92..1f7124d4de 100644 --- a/classes/controllers/FrmAppController.php +++ b/classes/controllers/FrmAppController.php @@ -580,8 +580,8 @@ public static function admin_init() { if ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) && ! FrmAppHelper::pro_is_installed() && current_user_can( 'frm_view_forms' ) ) { $redirect = FrmSalesApi::get_best_sale_value( 'menu_cta_link' ); $utm = array( - 'medium' => 'upgrade', - 'content' => 'submenu-upgrade', + 'campaign' => 'upgrade', + 'content' => 'submenu-upgrade', ); if ( $redirect ) { @@ -1334,8 +1334,18 @@ private static function enqueue_floating_links( $plugin_url, $version ) { wp_set_script_translations( 's11-floating-links-config', 's11-' ); } + $upgrade_utm = array( + 'campaign' => 'floating-links', + 'content' => 'floating-links-upgrade', + ); + $docs_utm = array( + 'campaign' => 'floating-links', + 'content' => 'floating-links-docs', + ); $floating_links_data = array( - 'proIsInstalled' => FrmAppHelper::pro_is_installed(), + 'proIsInstalled' => FrmAppHelper::pro_is_installed(), + 'upgradeUrl' => FrmAppHelper::admin_upgrade_link( $upgrade_utm ), + 'documentationUrl' => FrmAppHelper::admin_upgrade_link( $docs_utm, 'knowledgebase/' ), ); wp_localize_script( 's11-floating-links-config', 's11FloatingLinksData', $floating_links_data ); diff --git a/classes/controllers/FrmDashboardController.php b/classes/controllers/FrmDashboardController.php index 96dd97d546..0cebe1752f 100644 --- a/classes/controllers/FrmDashboardController.php +++ b/classes/controllers/FrmDashboardController.php @@ -256,7 +256,7 @@ private static function view_args_entries_placeholder( $forms_count ) { $copy = sprintf( /* translators: %1$s: HTML start of a tag, %2$s: HTML close a tag */ __( 'See the %1$sform documentation%2$s for instructions on publishing your form', 'formidable' ), - '', + '', '' ); return array( diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 4178637840..dc11ded934 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -306,7 +306,7 @@ public static function update( $values = array() ) { $message .= '
' . sprintf( /* translators: %1$s: Start link HTML, %2$s: end link HTML */ __( 'However, your form is very long and may be %1$sreaching server limits%2$s.', 'formidable' ), - '', + '', '' ); } @@ -318,6 +318,19 @@ public static function update( $values = array() ) { self::get_edit_vars( $id, array(), $message ); } + /** + * @since x.x + * + * @return string + */ + private static function get_form_too_long_docs_url() { + $utm = array( + 'campaign' => 'builder', + 'content' => 'form-too-long', + ); + return FrmAppHelper::admin_upgrade_link( $utm, 'knowledgebase/i-have-a-long-form-why-did-the-options-at-the-end-of-the-form-stop-saving/' ); + } + /** * Remove the draft flag from any new fields from this current session. * @@ -353,6 +366,7 @@ private static function maybe_remove_draft_option_from_fields( $form_id ) { * * @since 3.06.01 * + * @param array $values * @return bool */ private static function is_too_long( $values ) { diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php index d07449a6a2..d7ed4b767a 100644 --- a/classes/helpers/FrmAppHelper.php +++ b/classes/helpers/FrmAppHelper.php @@ -115,52 +115,97 @@ public static function get_affiliate() { /** * @since 3.04.02 - * @param array|string $args + * + * @param array|string $args If a string is passed, it is used for the utm_campaign attribute. * @param string $page */ public static function admin_upgrade_link( $args, $page = '' ) { - if ( empty( $page ) ) { - $page = 'https://formidableforms.com/lite-upgrade/'; - } else { + if ( $page ) { $page = str_replace( 'https://formidableforms.com/', '', $page ); $page = 'https://formidableforms.com/' . $page; + } else { + $page = 'https://formidableforms.com/lite-upgrade/'; } - $anchor = ''; if ( is_array( $args ) ) { - $medium = $args['medium'] ?? ''; - if ( isset( $args['content'] ) ) { - $content = $args['content']; - } - if ( isset( $args['anchor'] ) ) { - $anchor = '#' . $args['anchor']; - } + $args = self::adjust_legacy_utm_args( $args ); } else { - $medium = $args; + $args = array( 'campaign' => $args ); } $query_args = array( - 'utm_source' => 'WordPress', - 'utm_medium' => $medium, - 'utm_campaign' => 'liteplugin', + 'utm_source' => 'plugin', + 'utm_medium' => self::get_utm_medium(), ); + $query_args = self::maybe_add_utm_license( $query_args ); + + if ( isset( $args['campaign'] ) ) { + $query_args['utm_campaign'] = $args['campaign']; + } - if ( isset( $content ) ) { - $query_args['utm_content'] = $content; + if ( isset( $args['content'] ) ) { + $query_args['utm_content'] = $args['content']; } - if ( is_array( $args ) && isset( $args['param'] ) ) { + if ( isset( $args['param'] ) ) { $query_args['f'] = $args['param']; } - if ( is_array( $args ) && ! empty( $args['plan'] ) ) { + if ( ! empty( $args['plan'] ) ) { $query_args['plan'] = $args['plan']; } - $link = add_query_arg( $query_args, $page ) . $anchor; + $link = add_query_arg( $query_args, $page ); + + if ( isset( $args['anchor'] ) ) { + $link .= '#' . $args['anchor']; + } + return self::make_affiliate_url( $link ); } + /** + * If medium is "pro", add an additional utm_license param with their active license type. + * + * @since x.x + * + * @param array $query_args + * @return array + */ + private static function maybe_add_utm_license( $query_args ) { + if ( 'pro' === $query_args['utm_medium'] && is_callable( 'FrmProAddonsController::get_readable_license_type' ) ) { + $query_args['utm_license'] = strtolower( FrmProAddonsController::get_readable_license_type() ); + } + + return $query_args; + } + + /** + * @since x.x + * + * @return string + */ + private static function get_utm_medium() { + return self::pro_is_connected() ? 'pro' : 'lite'; + } + + /** + * Change campaign from "liteplugin" to what we're currently using for medium. + * + * @since x.x + * + * @param array $args + * @return array + */ + private static function adjust_legacy_utm_args( $args ) { + if ( isset( $args['medium'] ) ) { + $args['campaign'] = $args['medium']; + unset( $args['medium'] ); + } + + return $args; + } + /** * @since 6.21 * @@ -168,24 +213,27 @@ public static function admin_upgrade_link( $args, $page = '' ) { * @param array $utm */ public static function maybe_add_missing_utm( $cta_link, $utm ) { + $utm = self::adjust_legacy_utm_args( $utm ); $query_args = array(); if ( false === strpos( $cta_link, 'utm_source' ) ) { - $query_args['utm_source'] = 'WordPress'; + $query_args['utm_source'] = 'plugin'; } - if ( false === strpos( $cta_link, 'utm_campaign' ) ) { - $query_args['utm_campaign'] = 'liteplugin'; + if ( false === strpos( $cta_link, 'utm_medium' ) ) { + $query_args['utm_medium'] = self::get_utm_medium(); } - if ( false === strpos( $cta_link, 'utm_medium' ) && isset( $utm['medium'] ) ) { - $query_args['utm_medium'] = $utm['medium']; + if ( false === strpos( $cta_link, 'utm_campaign' ) && isset( $utm['campaign'] ) ) { + $query_args['utm_campaign'] = $utm['campaign']; } if ( false === strpos( $cta_link, 'utm_content' ) && isset( $utm['content'] ) ) { $query_args['utm_content'] = $utm['content']; } + $query_args = self::maybe_add_utm_license( $query_args ); + return $query_args ? add_query_arg( $query_args, $cta_link ) : $cta_link; } @@ -1462,8 +1510,8 @@ public static function print_admin_banner( $should_show_lite_upgrade ) { $upgrade_link = FrmSalesApi::get_best_sale_value( 'lite_banner_cta_link' ); $utm = array( - 'medium' => 'settings-license', - 'content' => 'lite-banner', + 'campaign' => 'settings-license', + 'content' => 'lite-banner', ); if ( $upgrade_link ) { @@ -3679,19 +3727,7 @@ public static function min_pro_version_notice( $min_version ) { return; } - $expired = FrmAddonsController::is_license_expired(); - ?> -
- update now.'; - } else { - echo '
Please renew now to get the latest version.'; - } - ?> -
- 'settings-license', - 'content' => 'dashboard-license-box', + 'campaign' => 'settings-license', + 'content' => 'dashboard-license-box', ); if ( $upgrade_link ) { diff --git a/classes/helpers/FrmEntriesListHelper.php b/classes/helpers/FrmEntriesListHelper.php index 579bf6b4e7..5f90b9b8ef 100644 --- a/classes/helpers/FrmEntriesListHelper.php +++ b/classes/helpers/FrmEntriesListHelper.php @@ -228,10 +228,14 @@ public function search_box( $text, $input_id ) { protected function display_tablenav( $which ) { $is_footer = ( $which !== 'top' ); if ( $is_footer && ! empty( $this->items ) ) { + $utm = array( + 'campaign' => 'spam-protection', + 'content' => 'entries-list-spam-protection', + ); ?>

- +

diff --git a/classes/models/fields/FrmFieldCaptcha.php b/classes/models/fields/FrmFieldCaptcha.php index 8ce0dedf44..b84de5acf7 100644 --- a/classes/models/fields/FrmFieldCaptcha.php +++ b/classes/models/fields/FrmFieldCaptcha.php @@ -180,6 +180,10 @@ protected function recaptcha_api_url( $frm_settings ) { $api_js_url .= '&hl=' . $lang; } + // Since this URL initially ends with ? and we never use add_query_arg, remove the extra + // & that appears immediately after the ? + $api_js_url = str_replace( '?&', '?', $api_js_url ); + /** * @param string $api_js_url */ diff --git a/classes/views/addons/min-version-notice.php b/classes/views/addons/min-version-notice.php new file mode 100644 index 0000000000..f8b1f0ad05 --- /dev/null +++ b/classes/views/addons/min-version-notice.php @@ -0,0 +1,20 @@ + +
+ + + + 'outdated', + 'content' => 'min-pro-version-notice', + ); + ?> + Please renew now to get the latest version. + + Please update now. + +
diff --git a/classes/views/addons/upgrade_to_pro.php b/classes/views/addons/upgrade_to_pro.php deleted file mode 100644 index b5840eb30c..0000000000 --- a/classes/views/addons/upgrade_to_pro.php +++ /dev/null @@ -1,5 +0,0 @@ - 'dashboard-discount', - 'content' => 'dashboard-defy-limits-cta', + 'campaign' => 'dashboard-discount', + 'content' => 'dashboard-defy-limits-cta', ); if ( $discount_link ) { $discount_link = FrmAppHelper::maybe_add_missing_utm( $discount_link, $utm ); diff --git a/classes/views/frm-entries/no_entries.php b/classes/views/frm-entries/no_entries.php index 729f12c623..2507225464 100644 --- a/classes/views/frm-entries/no_entries.php +++ b/classes/views/frm-entries/no_entries.php @@ -32,10 +32,14 @@

'entries', + 'content' => 'no-entries', + ); printf( /* translators: %1$s: Start link HTML, %2$s: End link HTML, %3$s: Line break HTML */ esc_html__( 'See the %1$sform documentation%2$s for instructions on publishing your form', 'formidable' ), - '', + '', '' ); ?> diff --git a/classes/views/frm-settings/general.php b/classes/views/frm-settings/general.php index 8d69e94302..e33c5b35a7 100644 --- a/classes/views/frm-settings/general.php +++ b/classes/views/frm-settings/general.php @@ -96,8 +96,16 @@

%s', 'https://formidableforms.com/knowledgebase/gdpr-settings/', esc_html__( 'here', 'formidable' ) ); + $gdpr_utm = array( + 'campaign' => 'gdpr-settings', + 'content' => 'gdpr-settings-docs', + ); + printf( + // translators: %1$s: Opening tag for a link, %2$s: Closing tag for a link + esc_html__( 'Learn more about our GDPR settings %1$shere%2$s', 'formidable' ), + '', + '' + ); ?>

diff --git a/classes/views/frm-settings/license_box.php b/classes/views/frm-settings/license_box.php index 4ffded0727..b227e65da8 100644 --- a/classes/views/frm-settings/license_box.php +++ b/classes/views/frm-settings/license_box.php @@ -10,8 +10,8 @@ $button_upgrade_link = FrmSalesApi::get_best_sale_value( 'global_settings_license_cta_link' ); $utm = array( - 'medium' => 'settings-license', - 'content' => 'global-settings-license-box-get-formidable-button', + 'campaign' => 'settings-license', + 'content' => 'global-settings-license-box-get-formidable-button', ); if ( $button_upgrade_link ) { $button_upgrade_link = FrmAppHelper::maybe_add_missing_utm( $button_upgrade_link, $utm ); @@ -26,8 +26,8 @@ $unlock_more_upgrade_link = FrmSalesApi::get_best_sale_value( 'global_settings_unlock_more_cta_link' ); $utm = array( - 'medium' => 'settings-license', - 'content' => 'global-settings-license-box-unlock-more', + 'campaign' => 'settings-license', + 'content' => 'global-settings-license-box-unlock-more', ); if ( $unlock_more_upgrade_link ) { $unlock_more_upgrade_link = FrmAppHelper::maybe_add_missing_utm( $unlock_more_upgrade_link, $utm ); diff --git a/classes/views/shared/admin-footer-links.php b/classes/views/shared/admin-footer-links.php index b76f08aa6b..ae55f15b30 100644 --- a/classes/views/shared/admin-footer-links.php +++ b/classes/views/shared/admin-footer-links.php @@ -8,7 +8,8 @@ $upgrade_link = FrmSalesApi::get_best_sale_value( 'footer_cta_link' ); $utm = array( - 'medium' => 'admin-footer-link', + 'campaign' => 'admin-footer-link', + 'content' => 'footer-link-upgrade', ); if ( $upgrade_link ) { $upgrade_link = FrmAppHelper::maybe_add_missing_utm( $upgrade_link, $utm ); @@ -35,7 +36,13 @@