/**
  * Adding adsense tracking
  *
  * This method will add adsense tracking code into the head
  */
 public static function add_adsense_tracking()
 {
     $tracking_code = Yoast_GA_Options::instance()->get_tracking_code();
     if (!empty($tracking_code) && Yoast_GA_Options::instance()->options['track_adsense'] == 1) {
         require_once dirname(GAWP_FILE) . '/premium/frontend/pages/tracking-adsense.php';
     }
 }
 /**
  * Initialize the premium functionality.
  *
  * This method will call specific method for initialising the admin or frontend functionality.
  *
  * It will even add the hook for default options.
  */
 public static function init()
 {
     self::$ga_options = Yoast_GA_Options::instance()->get_options();
     if (is_admin()) {
         self::init_admin();
     } else {
         self::init_frontend();
     }
     add_action('plugins_loaded', array('Yoast_GA_Premium', 'load_textdomain'));
     add_filter('yst_ga_default-ga-values', array('Yoast_GA_Premium', 'add_default_options'), 10, 2);
 }
Exemplo n.º 3
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->options = Yoast_GA_Options::instance()->options;
     if (isset($this->options['tag_links_in_rss']) && $this->options['tag_links_in_rss'] == 1) {
         add_filter('the_permalink_rss', array($this, 'rsslinktagger'), 99);
     }
     // Check if the customer is running Universal or not (Enable in GA Settings -> Universal)
     if (isset($this->options['enable_universal']) && $this->options['enable_universal'] == 1) {
         new Yoast_GA_Universal();
     } else {
         new Yoast_GA_JS();
     }
 }
 /**
  * Returns the GA tracking code
  *
  * @since 0.3
  */
 function get_raw_embed_code()
 {
     $options = Yoast_GA_Options::instance()->options;
     if (isset($options['enable_universal']) && 1 === intval($options['enable_universal'])) {
         $tracker = new Yoast_GA_Universal();
     } else {
         $tracker = new Yoast_GA_JS();
     }
     ob_start();
     $tracker->tracking();
     $ga_code = ob_get_clean();
     return $ga_code;
 }
Exemplo n.º 5
0
 public function __construct()
 {
     $this->options = Yoast_GA_Options::instance()->options;
     $this->link_regex = '`<a (.*?)href=[\'\\"](.*?):/*([^\'\\"]+)[\'\\"](.*?)>(.*?)</a>`i';
     add_action('wp_head', array($this, 'tracking'), 8);
     if ($this->options['track_outbound'] == 1) {
         // Check for outbound option
         add_filter('the_content', array($this, 'the_content'), 99);
         add_filter('widget_text', array($this, 'widget_content'), 99);
         add_filter('wp_list_bookmarks', array($this, 'widget_content'), 99);
         add_filter('wp_nav_menu', array($this, 'widget_content'), 99);
         add_filter('the_excerpt', array($this, 'the_content'), 99);
         add_filter('comment_text', array($this, 'comment_text'), 99);
     }
 }
Exemplo n.º 6
0
 public function __construct()
 {
     $this->options = Yoast_GA_Options::instance()->options;
     $this->link_regex = $this->get_regex();
     add_action('wp_head', array($this, 'tracking'), 8);
     if ($this->options['track_outbound'] == 1) {
         // Check for outbound
         add_filter('the_content', array($this, 'the_content'), 99);
         add_filter('widget_text', array($this, 'widget_content'), 99);
         add_filter('wp_list_bookmarks', array($this, 'widget_content'), 99);
         add_filter('wp_nav_menu', array($this, 'widget_content'), 99);
         add_filter('the_excerpt', array($this, 'the_content'), 99);
         add_filter('comment_text', array($this, 'comment_text'), 99);
     }
 }
Exemplo n.º 7
0
 /**
  * Constructor for the options
  */
 public function __construct()
 {
     $this->options = $this->get_options();
     $this->options = $this->check_options($this->options);
     $this->plugin_path = plugin_dir_path(GAWP_FILE);
     $this->plugin_url = trailingslashit(plugin_dir_url(GAWP_FILE));
     if (false == $this->options) {
         add_option($this->option_name, $this->default_ga_values());
         $this->options = $this->get_options();
     }
     if (!isset($this->options['version']) || $this->options['version'] < GAWP_VERSION) {
         $this->upgrade();
     }
     // If instance is null, create it. Prevent creating multiple instances of this class
     if (is_null(self::$instance)) {
         self::$instance = $this;
     }
 }
 /**
  * Fetches the options
  */
 protected function get_options()
 {
     return Yoast_GA_Options::instance()->get_options();
 }
Exemplo n.º 9
0
 /**
  * Getting the value from the option, if it doesn't exist return empty string
  *
  * @param string $name
  *
  * @return string
  */
 private static function get_formfield_from_options($name)
 {
     static $options;
     if ($options === null) {
         $options = Yoast_GA_Options::instance()->get_options();
     }
     // Catch a notice if the option doesn't exist, yet
     return isset($options[$name]) ? $options[$name] : '';
 }
Exemplo n.º 10
0
<?php

global $yoast_ga_admin;
$options_class = Yoast_GA_Options::instance();
$options = $options_class->get_options();
$tracking_code = $options_class->get_tracking_code();
echo $yoast_ga_admin->content_head();
?>
	<h2 id="yoast_ga_title"><?php 
echo __('Google Analytics by Yoast: ', 'google-analytics-for-wordpress') . __('Dashboard', 'google-analytics-for-wordpress');
?>
 <?php 
do_action('yst_ga_dashboard_title');
?>
</h2>

	<h2 class="nav-tab-wrapper" id="ga-tabs">
		<a class="nav-tab" id="general-tab" href="#top#general"><?php 
_e('Overview', 'google-analytics-for-wordpress');
?>
</a>
		<a class="nav-tab" id="dimensions-tab" href="#top#dimensions"><?php 
_e('Reports', 'google-analytics-for-wordpress');
?>
</a>
		<a class="nav-tab" id="customdimensions-tab" href="#top#customdimensions"><?php 
_e('Custom dimension reports', 'google-analytics-for-wordpress');
?>
</a>
	</h2>
 public function __construct()
 {
     $this->class_instance = Yoast_GA_Settings::get_instance();
     $this->class_options = Yoast_GA_Options::instance();
 }
 /**
  * Delegates `get_tracking_code` to the options class
  *
  * @return null
  */
 public function get_tracking_code()
 {
     return Yoast_GA_Options::instance()->get_tracking_code();
 }
Exemplo n.º 13
0
 /**
  * Set the options of Google Analytics
  */
 protected function __construct()
 {
     $this->options_class = Yoast_GA_Options::instance();
     $this->options = $this->options_class->get_options();
 }
 /**
  * Test the custom code in the tracking
  *
  * @covers Yoast_GA_JS::tracking()
  */
 public function test_custom_code()
 {
     $options_singleton = Yoast_GA_Options::instance();
     $options = $options_singleton->get_options();
     $options['custom_code'] = '__custom_code[\\"test\\"]';
     $options_singleton->update_option($options);
     // create and go to post
     $post_id = $this->factory->post->create();
     $this->go_to(get_permalink($post_id));
     // Get tracking code
     $tracking_data = $this->class_instance->tracking(true);
     if (is_array($tracking_data)) {
         foreach ($tracking_data as $row) {
             if (is_array($row)) {
                 if ($row['type'] == 'custom_code') {
                     $this->assertEquals($row['value'], '__custom_code["test"]');
                 }
             }
         }
     }
 }
 public function id()
 {
     if (is_null($this->id)) {
         $options = Yoast_GA_Options::instance()->options;
         $this->id = isset($options['analytics_profile']) ? $options['analytics_profile'] : '';
     }
     return $this->id;
 }
 public function __construct()
 {
     $this->class_instance = Yoast_GA_Options::instance();
 }