monsterinsights_get_upgrade_link

Called whenever an upgrade button / link is displayed in Lite, this function will check if there's a shareasale ID specified.

Description

(string) monsterinsights_get_upgrade_link(); 

There are three ways to specify an ID, ordered by highest to lowest priority - add_filter( monsterinsights_shareasale_id,, function() ); - define( MONSTERINSIGHTS_SHAREASALE_ID , 1234 ); - get_option( monsterinsights_shareasale_id, ); (with the option being in the wp_options table)

If an ID is present, returns the ShareASale link with the affiliate ID, and tells ShareASale to then redirect to monsterinsights.com/lite

If no ID is present, just returns the monsterinsights.com/lite URL with UTM tracking.

Returns (string)

Upgrade link.


Usage

  1. if ( !function_exists( 'monsterinsights_get_upgrade_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/common.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = monsterinsights_get_upgrade_link(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/common.php  
  1. function monsterinsights_get_upgrade_link() { 
  2.  
  3. if ( class_exists( 'MonsterInsights' ) ) { 
  4. // User is using MonsterInsights, so just take them to the Pricing page. 
  5. // Note: On the Addons screen, if the user has a license, we won't hit this function,  
  6. // as the API will tell us the direct URL to send the user to based on their license key,  
  7. // so they see pro-rata pricing. 
  8. return 'https://www.monsterinsights.com/pricing/?utm_source=proplugin&utm_medium=link&utm_campaign=WordPress'; 
  9.  
  10. $shareasale_id = monsterinsights_get_shareasale_id(); 
  11.  
  12. // If at this point we still don't have an ID, we really don't have one! 
  13. // Just return the standard upgrade URL. 
  14. if ( empty( $shareasale_id ) ) { 
  15. return 'https://www.monsterinsights.com/pricing/?utm_source=liteplugin&utm_medium=link&utm_campaign=WordPress'; 
  16.  
  17. // If here, we have a ShareASale ID 
  18. // Return ShareASale URL with redirect. 
  19. return 'https://www.shareasale.com/r.cfm?u=' . $shareasale_id . '&b=971799&m=69975&afftrack=&urllink=monsterinsights%2Ecom%2Flite%2F';