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
if ( !function_exists( 'gde_ga_event' ) ) { require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/functions.php'; } // The file. $file = null; // NOTICE! Understand what this does before running. $result = gde_ga_event($file);
Defined (1)
The function is defined in the following location(s).
- /functions.php
- function gde_ga_event( $file ) {
- global $gdeoptions;
- if ( $gdeoptions['ga_enable'] == "no" ) {
- return '';
- } elseif ( $gdeoptions['ga_enable'] == "compat" ) {
- $fnp = gde_split_filename( basename( $file ) );
- $category = "'Download'"; // intentionally not translated (it wasn't a translated string in < 2.5)
- $action = "'" . strtoupper( $fnp[1] ) . "'";
- $label = "this.href";
- } else {
- $category = "'" . addslashes( $gdeoptions['ga_category'] ) . "'";
- $action = "'" . __('Download', 'gde') . "'";
- if ( $gdeoptions['ga_label'] == "url" ) {
- $label = "this.href";
- } else {
- $label = "'" . basename( $file ) . "'";
- }
- }
- $str = "_gaq.push(['_trackEvent', ".$category.", ".$action.", ".$label."]);";
- return " onClick=\"" . $str . "\"";
- }