monsterinsights_get_ua

Helper method for getting the UA string.

Description

(string) monsterinsights_get_ua(); 

Returns (string)

The UA to use.


Usage

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

Defined (1)

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

/includes/options.php  
  1. function monsterinsights_get_ua() { 
  2. $ua = ''; 
  3. if ( is_multisite() ) { 
  4. if ( defined( 'MONSTERINSIGHTS_MS_GA_UA' ) && monsterinsights_is_valid_ua( MONSTERINSIGHTS_MS_GA_UA ) ) { 
  5. $ua = MONSTERINSIGHTS_MS_GA_UA; 
  6.  
  7. if ( is_multisite() ) { 
  8. $ua_code = monsterinsights_is_valid_ua( get_site_option( 'monsterinsights_network_manual_ua_code', '' ) ); 
  9. if ( $ua_code ) { 
  10. $ua = $ua_code; 
  11.  
  12. if ( defined( 'MONSTERINSIGHTS_GA_UA' ) && monsterinsights_is_valid_ua( MONSTERINSIGHTS_GA_UA ) ) { 
  13. $ua = MONSTERINSIGHTS_GA_UA; 
  14.  
  15. $ua_code = monsterinsights_is_valid_ua( monsterinsights_get_option( 'analytics_profile_code', '' ) ); 
  16.  
  17. if ( $ua_code ) { 
  18. $ua = $ua_code; 
  19.  
  20. $manual_ua_code = monsterinsights_is_valid_ua( monsterinsights_get_option( 'manual_ua_code', '' ) ); 
  21.  
  22. if ( $manual_ua_code ) { 
  23. $ua = $manual_ua_code; 
  24.  
  25. $ua = apply_filters( 'monsterinsights_get_ua', $ua ); 
  26.  
  27. return monsterinsights_is_valid_ua( $ua );