Yandex Metrica - Version 0.1.3

Version Description

  • Minor bug fixes
Download this release

Release Info

Developer m_uysl
Plugin Icon 128x128 Yandex Metrica
Version 0.1.3
Comparing to
See all releases

Version 0.1.3

class.metrica.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * @author Mustafa
4
+ * @package WordPress
5
+ * @subpackage Metrica Plugin
6
+ * @since 0.1
7
+ * @link http://api.yandex.com/metrika/
8
+ *
9
+ */
10
+
11
+
12
+ class Yandex_Metrica
13
+ {
14
+ public $counter_id;
15
+ public $webvisor;
16
+ public $clickmap;
17
+ public $tracklink;
18
+ public $trackbounce;
19
+
20
+ public function __construct()
21
+ {
22
+ add_action('plugins_loaded', array(&$this, 'plugin_localization'));
23
+ add_action('wp_footer', array(&$this, 'metrica_counter_display'));
24
+ add_action('admin_menu', array(&$this, 'metrica_admin_menu'));
25
+
26
+ }
27
+
28
+ /**
29
+ * Localization
30
+ */
31
+ function plugin_localization()
32
+ {
33
+ load_plugin_textdomain('yandex_metrica', false, '/yandex-metrica/languages/');
34
+ }
35
+
36
+ /**
37
+ * Admin menu function
38
+ */
39
+ function metrica_admin_menu()
40
+ {
41
+ add_options_page('Yandex Metrica', 'Yandex Metrica', 'manage_options' ,'metrica', array(&$this, 'metrica_settings_page'));
42
+ }
43
+
44
+ public function get_metrica_counter_id()
45
+ {
46
+ $metrica_data = $this->metrica_data;
47
+ $id = $metrica_data['counter_id'];
48
+ return $id;
49
+ }
50
+
51
+
52
+ function get_metrica_options()
53
+ {
54
+ $metrica_data = get_option('metrica_options');
55
+ return $metrica_data;
56
+ }
57
+
58
+
59
+ function metrica_settings_page()
60
+ {
61
+ global $wpdb, $wp_roles, $current_user;
62
+ //check user role
63
+ if ( !current_user_can( 'manage_options' ) ) {
64
+ wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
65
+ }
66
+ $metrica_data = $this->get_metrica_options();
67
+ $this->counter_id = $metrica_data['counter_id'];
68
+ include(WP_PLUGIN_DIR . '/yandex-metrica/settings.php');
69
+
70
+ }
71
+
72
+
73
+ function metrica_counter_display()
74
+ {
75
+ //output
76
+ $metrica_data = $this->get_metrica_options();
77
+
78
+
79
+ echo'<!--Yandex.Metrika counter by metrica plugin-->
80
+ <script type = "text/javascript" >
81
+ (function (d, w, c) {
82
+ (w[c] = w[c] || []).push(function () {
83
+ try {
84
+ w.yaCounter'.$metrica_data['counter_id'].' = new Ya.Metrika({id:'.$metrica_data['counter_id'].',
85
+ webvisor:'.$metrica_data['webvisor'].',
86
+ clickmap:'.$metrica_data['clickmap'].',
87
+ trackLinks:'.$metrica_data['tracklinks'].',
88
+ accurateTrackBounce:'.$metrica_data['accurate_track'].'
89
+ });
90
+ } catch (e) {
91
+ }
92
+ });
93
+
94
+ var n = d.getElementsByTagName("script")[0],
95
+ s = d.createElement("script"),
96
+ f = function () { n.parentNode.insertBefore(s, n); };
97
+ s.type = "text/javascript";
98
+ s.async = true;
99
+ s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
100
+
101
+ if (w.opera == "[object Opera]") {
102
+ d.addEventListener("DOMContentLoaded", f, false);
103
+ } else { f(); }
104
+ })(document, window, "yandex_metrika_callbacks");
105
+ </script>
106
+ <noscript><div><img src="//mc.yandex.ru/watch/'.$metrica_data['counter_id'].'" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
107
+ <!-- /Yandex.Metrika counter -->
108
+ ';
109
+
110
+ }
111
+
112
+
113
+
114
+ }
115
+
116
+ $metrica = new Yandex_Metrica;
117
+
languages/yandex_metrica-tr_TR.mo ADDED
Binary file
languages/yandex_metrica-tr_TR.po ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Yandex Metrica\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-01-27 18:44+0200\n"
6
+ "PO-Revision-Date: 2013-01-27 18:44+0200\n"
7
+ "Last-Translator: LettoBlog <support@lettoblog.com>\n"
8
+ "Language-Team: Mustafa Uysal\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: PHP\n"
15
+ "X-Poedit-Country: TURKEY\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../class.metrica.php:67
19
+ msgid "You do not have sufficient permissions to access this page."
20
+ msgstr "Bu sayfayı görüntülemek için gerekli yetkiye sahip değilsiniz."
21
+
22
+ #: ../class.metrica.php:134
23
+ msgid "Options saved"
24
+ msgstr "Ayarlar kaydedildi"
25
+
26
+ #: ../settings.php:9
27
+ msgid "Metrica Counter ID"
28
+ msgstr "Metrica Sayaç Numarası"
29
+
30
+ #: ../settings.php:18
31
+ msgid "Webvisor"
32
+ msgstr "Webvisor"
33
+
34
+ #: ../settings.php:27
35
+ msgid "Track Clickmap"
36
+ msgstr "Tıklama Haritası"
37
+
38
+ #: ../settings.php:37
39
+ msgid "Track Links, social sharing, file requests..."
40
+ msgstr "Dış bağlantılar, dosya yüklemeleri ve \"Paylaş\" butonu raporu"
41
+
42
+ #: ../settings.php:46
43
+ msgid "Accurate Track Bounce"
44
+ msgstr "Hemen çıkma oranı"
45
+
46
+ #: ../settings.php:56
47
+ msgid "Save Changes"
48
+ msgstr "Değişiklikleri Kaydet"
49
+
languages/yandex_metrica.pot ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Yandex Metrica\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2013-01-27 18:44+0200\n"
6
+ "PO-Revision-Date: 2013-01-27 18:44+0200\n"
7
+ "Last-Translator: LettoBlog <support@lettoblog.com>\n"
8
+ "Language-Team: Mustafa Uysal\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: PHP\n"
15
+ "X-Poedit-Country: TURKEY\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../class.metrica.php:67
19
+ msgid "You do not have sufficient permissions to access this page."
20
+ msgstr ""
21
+
22
+ #: ../class.metrica.php:134
23
+ msgid "Options saved"
24
+ msgstr ""
25
+
26
+ #: ../settings.php:9
27
+ msgid "Metrica Counter ID"
28
+ msgstr ""
29
+
30
+ #: ../settings.php:18
31
+ msgid "Webvisor"
32
+ msgstr ""
33
+
34
+ #: ../settings.php:27
35
+ msgid "Track Clickmap"
36
+ msgstr ""
37
+
38
+ #: ../settings.php:37
39
+ msgid "Track Links, social sharing, file requests..."
40
+ msgstr ""
41
+
42
+ #: ../settings.php:46
43
+ msgid "Accurate Track Bounce"
44
+ msgstr ""
45
+
46
+ #: ../settings.php:56
47
+ msgid "Save Changes"
48
+ msgstr ""
49
+
metrica.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Yandex Metrica
4
+ Plugin URI: http://uysalmustafa.com/plugins/yandex-metrica
5
+ Description: Easy way to use Yandex Metrica in your WordPress site.
6
+ Author: Mustafa Uysal
7
+ Version: 0.1.3
8
+ Text Domain: yandex_metrica
9
+ Domain Path: /languages/
10
+ Author URI: http://blog.uysalmustafa.com
11
+ License: GPLv2 (or later)
12
+ */
13
+
14
+ if (!defined('WP_CONTENT_URL'))
15
+ define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
16
+ if (!defined('WP_CONTENT_DIR'))
17
+ define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
18
+ if (!defined('WP_PLUGIN_URL'))
19
+ define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins');
20
+ if (!defined('WP_PLUGIN_DIR'))
21
+ define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');
22
+
23
+
24
+ require_once(WP_PLUGIN_DIR . '/yandex-metrica/class.metrica.php');
25
+ require_once(WP_PLUGIN_DIR . '/yandex-metrica/widget.php');
26
+
27
+
28
+ ////////// YANDEXLE YANDEXLE.... :) \\\\\\\\\\\\\\\
readme.txt ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Yandex Metrica ===
2
+ Contributors: m_uysl
3
+ Tags: yandex,metrica,stats,statistics,tools,analytics,analytics tool,metrika
4
+ Requires at least: 3.0
5
+ Tested up to: 3.6
6
+ Stable tag: 0.1.3
7
+ License: GPLv2 (or later)
8
+
9
+ Easy way to use Yandex Metrica in your WordPress site.
10
+
11
+ == Description ==
12
+ Enter your counter id, and track your site easily. Also you can use metrica informer widget.
13
+
14
+ = What is Metrica =
15
+ Metrica is an analytics tool like as google analytics.If you didn't hear metrica yet, you can <a href="http://metrica.yandex.com/">check official metrica</a> page.
16
+
17
+
18
+ = Translations =
19
+
20
+ * English (en\_US), built-in
21
+ * Turkish (tr\_TR), native support
22
+
23
+
24
+ = Roadmap =
25
+
26
+ Here is the sort of things that are on my radar:
27
+
28
+ * Role based tracking
29
+ * Metrica API Support, you will be able to access statical information from WordPress dashboard
30
+
31
+ == Installation ==
32
+
33
+ Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from admin's Plugins page.
34
+ == Frequently Asked Questions ==
35
+
36
+ * What is metrica?
37
+ - Metrica is a powerful analytics tool that provided by Yandex.
38
+ * Is it free?
39
+ - Definitely, metrica service and this plugin totally free.
40
+ * Can I see statistics on the WordPress dashboard?
41
+ - Not yet, maybe in the future...
42
+
43
+ == Screenshots ==
44
+ 1. screenshot-1.png
45
+
46
+ == Changelog ==
47
+ = 0.1.3 =
48
+ - Minor bug fixes
49
+
50
+ = 0.1.2 =
51
+ - Bug fix - about options
52
+
53
+ = 0.1.1 =
54
+ - bug fix - header output
55
+
56
+ = 0.1 =
57
+
58
+ Initial release.
screenshot-1.png ADDED
Binary file
settings.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (isset($_POST['save'])) {
3
+
4
+ $metrica_options = array();
5
+ $metrica_options['counter_id'] = $_POST['metrica_counter_id'];
6
+ $metrica_options['webvisor'] = empty($_POST['metrica_webvisor']) ? 'false' : 'true';
7
+ $metrica_options['clickmap'] = empty($_POST['metrica_clickmap']) ? 'false' : 'true';
8
+ $metrica_options['tracklinks'] = empty($_POST['metrica_tracklinks']) ? 'false' : 'true';
9
+ $metrica_options['accurate_track'] = empty($_POST['metrica_accurate_track']) ? 'false' : 'true';
10
+
11
+ $metrica_data = $metrica_options;
12
+ update_option("metrica_options", $metrica_data);
13
+
14
+
15
+
16
+ echo ' <div class="updated"><p>' . __('Options saved','yandex_metrica') . '</p></div>';
17
+ }
18
+ ?>
19
+
20
+ <div class="wrap">
21
+ <h2>Yandex Metrica</h2>
22
+ <form method="post" action="">
23
+
24
+ <table class="form-table">
25
+
26
+ <tr>
27
+ <td>
28
+ <label><?php _e('Metrica Counter ID', 'yandex_metrica');?>:</label>
29
+ <input type="text" name="metrica_counter_id" value="<?php echo $metrica_data['counter_id']; ?>"/>
30
+ </td>
31
+ </tr>
32
+
33
+ <tr>
34
+ <td>
35
+ <input type="checkbox" <?php if ($metrica_data['webvisor'] == 'true') {
36
+ echo 'checked=checked';
37
+ }; ?> name="metrica_webvisor" value="1"> <?php _e('Webvisor', 'yandex_metrica')?>
38
+ </td>
39
+ </tr>
40
+
41
+
42
+ <tr>
43
+ <td>
44
+ <input type="checkbox" <?php if ($metrica_data['clickmap'] == 'true') {
45
+ echo 'checked=checked';
46
+ }; ?> name="metrica_clickmap" value="1"> <?php _e('Track Clickmap', 'yandex_metrica');?>
47
+ </td>
48
+ </tr>
49
+
50
+
51
+ <tr>
52
+ <td>
53
+ <input type="checkbox" <?php if ($metrica_data['tracklinks'] == 'true') {
54
+ echo 'checked=checked';
55
+ }; ?> name="metrica_tracklinks"
56
+ value="1"> <?php _e('Track Links, social sharing, file requests...', 'yandex_metrica');?>
57
+ </td>
58
+ </tr>
59
+
60
+ <tr>
61
+ <td>
62
+ <input type="checkbox" <?php if ($metrica_data['accurate_track'] == 'true') {
63
+ echo 'checked=checked';
64
+ }; ?> name="metrica_accurate_track"
65
+ value="1"> <?php _e('Accurate Track Bounce', 'yandex_metrica');?>
66
+ </td>
67
+ </tr>
68
+
69
+
70
+ </table>
71
+
72
+ <input type="hidden" name="action" value="update"/>
73
+
74
+ <p class="submit">
75
+ <input type="submit" name="save" class="button-primary" value="<?php _e('Save Changes') ?>"/>
76
+ </p>
77
+
78
+
79
+
80
+
81
+ </form>
82
+ </div>
widget.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yandex Informer widget
4
+ */
5
+ function metrica_widget()
6
+ {
7
+ $metrica_data = get_option('metrica_options');
8
+ $metrica_id = $metrica_data['counter_id'];
9
+ echo '<img src="http://bs.yandex.ru/informer/' . $metrica_id . '/3_1_FFFFFFFF_EFEFEFFF_0_pageviews" style="width:80px; height:31px; border:0;" />';
10
+ }
11
+
12
+ wp_register_sidebar_widget(
13
+ 'metrica_informer',
14
+ 'Metrica Informer',
15
+ 'metrica_widget',
16
+ array(
17
+ 'description' => 'Add metrica Informer to your sidebar, share daily statistics'
18
+ )
19
+ );