gde_ga_event

Google Analytics Integration.

Description

(string) gde_ga_event( $file ); 

Returns (string)

GA tracking event tag, or blank if disabled

Parameters (1)

0. $file
The file.

Usage

  1. if ( !function_exists( 'gde_ga_event' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/functions.php'; 
  3.  
  4. // The file. 
  5. $file = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gde_ga_event($file); 
  9.  

Defined (1)

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

/functions.php  
  1. function gde_ga_event( $file ) { 
  2. global $gdeoptions; 
  3.  
  4. if ( $gdeoptions['ga_enable'] == "no" ) { 
  5. return ''; 
  6. } elseif ( $gdeoptions['ga_enable'] == "compat" ) { 
  7. $fnp = gde_split_filename( basename( $file ) ); 
  8. $category = "'Download'"; // intentionally not translated (it wasn't a translated string in < 2.5) 
  9. $action = "'" . strtoupper( $fnp[1] ) . "'"; 
  10. $label = "this.href"; 
  11. } else { 
  12. $category = "'" . addslashes( $gdeoptions['ga_category'] ) . "'"; 
  13. $action = "'" . __('Download', 'google-document-embedder') . "'"; 
  14. if ( $gdeoptions['ga_label'] == "url" ) { 
  15. $label = "this.href"; 
  16. } else { 
  17. $label = "'" . basename( $file ) . "'"; 
  18.  
  19. $str = "_gaq.push(['_trackEvent', ".$category.", ".$action.", ".$label."]);"; 
  20. return " onClick=\"" . $str . "\"";