monsterinsights_tracking_script

Get frontend tracking options.

Description

(array) monsterinsights_tracking_script(); 

This function is used to return an array of parameters for the frontend_output() function to output. These are generally dimensions and turned on GA features.

Returns (array)

Array of the options to use.


Usage

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

Defined (1)

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

/includes/frontend/frontend.php  
  1. function monsterinsights_tracking_script( ) { 
  2.  
  3. $tracking_mode = monsterinsights_get_option( 'tracking_mode', 'analytics' ); 
  4. require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/class-tracking-abstract.php'; 
  5. $mode = ''; 
  6.  
  7. if ( is_preview() ) { 
  8. $mode = 'preview'; 
  9. $mode = 'disabled'; 
  10. } else if ( $tracking_mode === 'analytics' ) { 
  11. $mode = 'analytics'; 
  12. } else if ( $tracking_mode === 'ga' ) { 
  13. $mode = 'ga'; 
  14. } else { 
  15. //$mode = apply_filters( 'monsterinsights_custom_tracking_name', 'name-of-method' ); 
  16.  
  17. do_action( 'monsterinsights_tracking_before', $mode ); 
  18.  
  19. switch ( $mode ) { 
  20. case 'preview': 
  21. require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-preview.php'; 
  22. $tracking = new MonsterInsights_Tracking_Preview(); 
  23. echo $tracking->frontend_output(); 
  24. break; 
  25.  
  26. case 'disabled': 
  27. require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-disabled.php'; 
  28. $tracking = new MonsterInsights_Tracking_Disabled(); 
  29. echo $tracking->frontend_output(); 
  30. break; 
  31.  
  32. case 'analytics': 
  33. require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-analytics.php'; 
  34. echo $tracking->frontend_output(); 
  35. break; 
  36.  
  37. case 'ga': 
  38. require_once plugin_dir_path( MONSTERINSIGHTS_PLUGIN_FILE ) . 'includes/frontend/tracking/class-tracking-ga.php'; 
  39. $tracking = new MonsterInsights_Tracking_GA(); 
  40. echo $tracking->frontend_output(); 
  41. break; 
  42.  
  43. default: 
  44. //do_action( 'monsterinsights_custom_tracking' ); 
  45. break; 
  46.  
  47. do_action( 'monsterinsights_tracking_after', $mode );