Version Description
- Using the admin_url() function for internal links. Should help people with WP installed in a sub directory.
- Added all vars to reset function to delete / deauthorize from Google.
Download this release
Release Info
Developer | VideoUserManuals |
Plugin | ![]() |
Version | 6.3.3 |
Comparing to | |
See all releases |
Code changes from version 6.2 to 6.3.3
- class.analytics.stats.php +249 -360
- download-button.png +0 -0
- external-tracking.js +43 -43
- external-tracking.min.js +4 -4
- google-analyticator.php +1049 -1036
- google-analytics-stats-widget.php +254 -256
- google-analytics-summary-widget.php +617 -603
- google-api-php-client/src/Google_Client.php +465 -0
- google-api-php-client/src/auth/Google_AssertionCredentials.php +95 -0
- google-api-php-client/src/auth/Google_Auth.php +36 -0
- google-api-php-client/src/auth/Google_AuthNone.php +48 -0
- google-api-php-client/src/auth/Google_LoginTicket.php +63 -0
- google-api-php-client/src/auth/Google_OAuth2.php +444 -0
- google-api-php-client/src/auth/Google_P12Signer.php +66 -0
- google-api-php-client/src/auth/Google_PemVerifier.php +66 -0
- google-api-php-client/src/auth/Google_Signer.php +30 -0
- google-api-php-client/src/auth/Google_Verifier.php +31 -0
- google-api-php-client/src/cache/Google_ApcCache.php +98 -0
- google-api-php-client/src/cache/Google_Cache.php +55 -0
- google-api-php-client/src/cache/Google_FileCache.php +137 -0
- google-api-php-client/src/cache/Google_MemcacheCache.php +130 -0
- google-api-php-client/src/config.php +81 -0
- google-api-php-client/src/contrib/Google_AdsenseService.php +1144 -0
- google-api-php-client/src/contrib/Google_AnalyticsService.php +1887 -0
- google-api-php-client/src/contrib/Google_Oauth2Service.php +265 -0
- google-api-php-client/src/external/URITemplateParser.php +213 -0
- google-api-php-client/src/io/Google_CacheParser.php +173 -0
- google-api-php-client/src/io/Google_CurlIO.php +278 -0
- google-api-php-client/src/io/Google_HttpRequest.php +304 -0
- google-api-php-client/src/io/Google_IO.php +49 -0
- google-api-php-client/src/io/Google_REST.php +128 -0
- google-api-php-client/src/io/cacerts.pem +714 -0
- google-api-php-client/src/service/Google_BatchRequest.php +110 -0
- google-api-php-client/src/service/Google_MediaFileUpload.php +244 -0
- google-api-php-client/src/service/Google_Model.php +115 -0
- google-api-php-client/src/service/Google_Service.php +22 -0
- google-api-php-client/src/service/Google_ServiceResource.php +196 -0
- google-api-php-client/src/service/Google_Utils.php +117 -0
- google-api-php-client/static/Credentials.png +0 -0
- jquery.sparkline.min.js +84 -84
- privacy.png +0 -0
- readme.txt +40 -10
- wlcms-plugin-advert.png +0 -0
class.analytics.stats.php
CHANGED
@@ -1,360 +1,249 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
# Include SimplePie if it doesn't exist
|
4 |
-
if ( !class_exists('SimplePie') ) {
|
5 |
-
require_once (ABSPATH . WPINC . '/class-feed.php');
|
6 |
-
}
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
var $
|
20 |
-
var $
|
21 |
-
var $
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
*
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
$
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
$
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
}
|
248 |
-
|
249 |
-
|
250 |
-
* Get a specific data metrics
|
251 |
-
*
|
252 |
-
* @param metrics - the metrics to get
|
253 |
-
* @param startDate - the start date to get
|
254 |
-
* @param endDate - the end date to get
|
255 |
-
* @param dimensions - the dimensions to grab
|
256 |
-
* @param sort - the properties to sort on
|
257 |
-
* @param filter - the property to filter on
|
258 |
-
* @param limit - the number of items to get
|
259 |
-
* @return the specific metrics in array form
|
260 |
-
**/
|
261 |
-
function getMetrics($metric, $startDate, $endDate, $dimensions = false, $sort = false, $filter = false, $limit = false)
|
262 |
-
{
|
263 |
-
# Ensure the start date is after Jan 1 2005
|
264 |
-
$startDate = $this->verifyStartDate($startDate);
|
265 |
-
|
266 |
-
# Build the query url
|
267 |
-
$url = $this->baseFeed . "/data?ids=$this->accountId&start-date=$startDate&end-date=$endDate&metrics=$metric";
|
268 |
-
|
269 |
-
# Add optional dimensions
|
270 |
-
if ( $dimensions )
|
271 |
-
$url .= "&dimensions=$dimensions";
|
272 |
-
|
273 |
-
# Add optional sort
|
274 |
-
if ( $sort )
|
275 |
-
$url .= "&sort=$sort";
|
276 |
-
|
277 |
-
# Add optional filter
|
278 |
-
if ( $filter )
|
279 |
-
$url .= "&filters=$filter";
|
280 |
-
|
281 |
-
# Add optional limit
|
282 |
-
if ( $limit )
|
283 |
-
$url .= "&max-results=$limit";
|
284 |
-
|
285 |
-
# Request the metric data
|
286 |
-
$response = $this->http($url);
|
287 |
-
|
288 |
-
# Check if the response received exists, else stop processing now
|
289 |
-
if ( $response == '' || $this->responseCode != '200' )
|
290 |
-
return false;
|
291 |
-
|
292 |
-
# Parse the XML using SimplePie
|
293 |
-
$simplePie = new SimplePie();
|
294 |
-
$simplePie->set_raw_data($response);
|
295 |
-
$simplePie->enable_order_by_date(false);
|
296 |
-
$simplePie->init();
|
297 |
-
$simplePie->handle_content_type();
|
298 |
-
$datas = $simplePie->get_items();
|
299 |
-
|
300 |
-
$ids = array();
|
301 |
-
|
302 |
-
# Read out the data until the metric is found
|
303 |
-
foreach ( $datas AS $data ) {
|
304 |
-
$metrics = $data->get_item_tags('http://schemas.google.com/analytics/2009', 'metric');
|
305 |
-
$dimensions = $data->get_item_tags('http://schemas.google.com/analytics/2009', 'dimension');
|
306 |
-
$id = array();
|
307 |
-
|
308 |
-
$id['title'] = $data->get_title();
|
309 |
-
|
310 |
-
# Loop through the dimensions
|
311 |
-
if ( is_array($dimensions) ) {
|
312 |
-
foreach ( $dimensions AS $property ) {
|
313 |
-
|
314 |
-
# Get the property information
|
315 |
-
$name = $property['attribs']['']['name'];
|
316 |
-
$value = $property['attribs']['']['value'];
|
317 |
-
|
318 |
-
# Add the propery data to the id array
|
319 |
-
$id[$name] = $value;
|
320 |
-
|
321 |
-
}
|
322 |
-
}
|
323 |
-
|
324 |
-
# Loop through the metrics
|
325 |
-
if ( is_array($metrics) ) {
|
326 |
-
foreach ( $metrics AS $property ) {
|
327 |
-
|
328 |
-
# Get the property information
|
329 |
-
$name = $property['attribs']['']['name'];
|
330 |
-
$value = $property['attribs']['']['value'];
|
331 |
-
|
332 |
-
# Add the propery data to the id array
|
333 |
-
$id[$name] = $value;
|
334 |
-
|
335 |
-
}
|
336 |
-
}
|
337 |
-
|
338 |
-
$ids[] = $id;
|
339 |
-
}
|
340 |
-
|
341 |
-
return $ids;
|
342 |
-
}
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Checks the date against Jan. 1 2005 because GA API only works until that date
|
346 |
-
*
|
347 |
-
* @param date - the date to compare
|
348 |
-
* @return the correct date
|
349 |
-
**/
|
350 |
-
function verifyStartDate($date)
|
351 |
-
{
|
352 |
-
if ( strtotime($date) > strtotime('2005-01-01') )
|
353 |
-
return $date;
|
354 |
-
else
|
355 |
-
return '2005-01-01';
|
356 |
-
}
|
357 |
-
|
358 |
-
} // END class
|
359 |
-
|
360 |
-
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
# Include SimplePie if it doesn't exist
|
4 |
+
if ( !class_exists('SimplePie') ) {
|
5 |
+
require_once (ABSPATH . WPINC . '/class-feed.php');
|
6 |
+
}
|
7 |
+
|
8 |
+
require_once 'google-api-php-client/src/Google_Client.php';
|
9 |
+
require_once 'google-api-php-client/src/contrib/Google_AnalyticsService.php';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Handles interactions with Google Analytics' Stat API
|
13 |
+
*
|
14 |
+
* @author http://www.codebyjeff.com
|
15 |
+
**/
|
16 |
+
class GoogleAnalyticsStats
|
17 |
+
{
|
18 |
+
|
19 |
+
var $client = false;
|
20 |
+
var $accountId;
|
21 |
+
var $baseFeed = 'https://www.googleapis.com/analytics/v3';
|
22 |
+
var $token = false;
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Constructor
|
27 |
+
*
|
28 |
+
* @param token - a one-time use token to be exchanged for a real token
|
29 |
+
**/
|
30 |
+
function GoogleAnalyticsStats()
|
31 |
+
{
|
32 |
+
|
33 |
+
$this->client = new Google_Client();
|
34 |
+
|
35 |
+
$this->client->setClientId(GOOGLE_ANALYTICATOR_CLIENTID);
|
36 |
+
$this->client->setClientSecret(GOOGLE_ANALYTICATOR_CLIENTSECRET);
|
37 |
+
$this->client->setRedirectUri(GOOGLE_ANALYTICATOR_REDIRECT);
|
38 |
+
$this->client->setScopes(array(GOOGLE_ANALYTICATOR_SCOPE));
|
39 |
+
|
40 |
+
// Magic. Returns objects from the Analytics Service instead of associative arrays.
|
41 |
+
$this->client->setUseObjects(true);
|
42 |
+
|
43 |
+
try {
|
44 |
+
$this->analytics = new Google_AnalyticsService($this->client);
|
45 |
+
}
|
46 |
+
catch (Google_ServiceException $e)
|
47 |
+
{
|
48 |
+
print 'There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
}
|
53 |
+
|
54 |
+
function checkLogin()
|
55 |
+
{
|
56 |
+
$ga_google_authtoken = get_option('ga_google_authtoken');
|
57 |
+
|
58 |
+
if (!empty($ga_google_authtoken))
|
59 |
+
{
|
60 |
+
$this->client->setAccessToken($ga_google_authtoken);
|
61 |
+
}
|
62 |
+
else
|
63 |
+
{
|
64 |
+
$authCode = get_option('ga_google_token');
|
65 |
+
|
66 |
+
if (empty($authCode)) return false;
|
67 |
+
|
68 |
+
|
69 |
+
$accessToken = $this->client->authenticate($authCode);
|
70 |
+
|
71 |
+
if($accessToken)
|
72 |
+
{
|
73 |
+
$this->client->setAccessToken($accessToken);
|
74 |
+
update_option('ga_google_authtoken', $accessToken);
|
75 |
+
}
|
76 |
+
else
|
77 |
+
{
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
$this->token = $this->client->getAccessToken();
|
83 |
+
return true;
|
84 |
+
}
|
85 |
+
|
86 |
+
function deauthorize()
|
87 |
+
{
|
88 |
+
update_option('ga_google_token', '');
|
89 |
+
update_option('ga_google_authtoken', '');
|
90 |
+
}
|
91 |
+
|
92 |
+
function getSingleProfile()
|
93 |
+
{
|
94 |
+
|
95 |
+
$webproperty_id = get_option('ga_uid');
|
96 |
+
list($pre, $account_id, $post) = explode('-',$webproperty_id);
|
97 |
+
|
98 |
+
if (empty($webproperty_id)) return false;
|
99 |
+
|
100 |
+
try {
|
101 |
+
$profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
|
102 |
+
}
|
103 |
+
catch (Google_ServiceException $e)
|
104 |
+
{
|
105 |
+
print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
|
106 |
+
return false;
|
107 |
+
}
|
108 |
+
|
109 |
+
$profile_id = $profiles->items[0]->id;
|
110 |
+
if (empty($profile_id)) return false;
|
111 |
+
|
112 |
+
$account_array = array();
|
113 |
+
array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
|
114 |
+
return $account_array;
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
function getAllProfiles()
|
119 |
+
{
|
120 |
+
$profile_array = array();
|
121 |
+
|
122 |
+
try {
|
123 |
+
$profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
|
124 |
+
}
|
125 |
+
catch (Google_ServiceException $e)
|
126 |
+
{
|
127 |
+
print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
if( !empty( $profiles->items ) )
|
132 |
+
{
|
133 |
+
foreach( $profiles->items as $profile )
|
134 |
+
{
|
135 |
+
$profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
return $profile_array;
|
140 |
+
}
|
141 |
+
|
142 |
+
function getAnalyticsAccounts()
|
143 |
+
{
|
144 |
+
$analytics = new Google_AnalyticsService($this->client);
|
145 |
+
$accounts = $analytics->management_accounts->listManagementAccounts();
|
146 |
+
$account_array = array();
|
147 |
+
|
148 |
+
$items = $accounts->getItems();
|
149 |
+
|
150 |
+
if (count($items) > 0) {
|
151 |
+
foreach ($items as $key => $item)
|
152 |
+
{
|
153 |
+
$account_id = $item->getId();
|
154 |
+
|
155 |
+
$webproperties = $analytics->management_webproperties->listManagementWebproperties($account_id);
|
156 |
+
|
157 |
+
if (!empty($webproperties))
|
158 |
+
{
|
159 |
+
foreach ($webproperties->getItems() as $webp_key => $webp_item) {
|
160 |
+
$profiles = $analytics->management_profiles->listManagementProfiles($account_id, $webp_item->id);
|
161 |
+
|
162 |
+
$profile_id = $profiles->items[0]->id;
|
163 |
+
array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webp_item->id));
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
return $account_array;
|
169 |
+
}
|
170 |
+
return false;
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Sets the account id to use for queries
|
178 |
+
*
|
179 |
+
* @param id - the account id
|
180 |
+
**/
|
181 |
+
function setAccount($id)
|
182 |
+
{
|
183 |
+
$this->accountId = $id;
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Get a specific data metrics
|
189 |
+
*
|
190 |
+
* @param metrics - the metrics to get
|
191 |
+
* @param startDate - the start date to get
|
192 |
+
* @param endDate - the end date to get
|
193 |
+
* @param dimensions - the dimensions to grab
|
194 |
+
* @param sort - the properties to sort on
|
195 |
+
* @param filter - the property to filter on
|
196 |
+
* @param limit - the number of items to get
|
197 |
+
* @return the specific metrics in array form
|
198 |
+
**/
|
199 |
+
function getMetrics($metric, $startDate, $endDate, $dimensions = false, $sort = false, $filter = false, $limit = false)
|
200 |
+
{
|
201 |
+
$analytics = new Google_AnalyticsService($this->client);
|
202 |
+
|
203 |
+
$params = array();
|
204 |
+
|
205 |
+
if ($dimensions)
|
206 |
+
{
|
207 |
+
$params['dimensions'] = $dimensions;
|
208 |
+
}
|
209 |
+
if ($sort)
|
210 |
+
{
|
211 |
+
$params['sort'] = $sort;
|
212 |
+
}
|
213 |
+
if ($filter)
|
214 |
+
{
|
215 |
+
$params['filters'] = $filter;
|
216 |
+
}
|
217 |
+
if ($limit)
|
218 |
+
{
|
219 |
+
$params['max-results'] = $limit;
|
220 |
+
}
|
221 |
+
|
222 |
+
return $analytics->data_ga->get(
|
223 |
+
'ga:' . $this->accountId,
|
224 |
+
$startDate,
|
225 |
+
$endDate,
|
226 |
+
$metric,
|
227 |
+
$params
|
228 |
+
);
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
|
233 |
+
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Checks the date against Jan. 1 2005 because GA API only works until that date
|
237 |
+
*
|
238 |
+
* @param date - the date to compare
|
239 |
+
* @return the correct date
|
240 |
+
**/
|
241 |
+
function verifyStartDate($date)
|
242 |
+
{
|
243 |
+
if ( strtotime($date) > strtotime('2005-01-01') )
|
244 |
+
return $date;
|
245 |
+
else
|
246 |
+
return '2005-01-01';
|
247 |
+
}
|
248 |
+
|
249 |
+
} // END class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
download-button.png
ADDED
Binary file
|
external-tracking.js
CHANGED
@@ -1,44 +1,44 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
|
3 |
-
jQuery('a').each(function() {
|
4 |
-
var a = jQuery(this);
|
5 |
-
var href = a.attr('href');
|
6 |
-
|
7 |
-
// Check if the a tag has a href, if not, stop for the current link
|
8 |
-
if ( href == undefined )
|
9 |
-
return;
|
10 |
-
|
11 |
-
var url = href.replace('http://','').replace('https://','');
|
12 |
-
var hrefArray = href.split('.').reverse();
|
13 |
-
var extension = hrefArray[0].toLowerCase();
|
14 |
-
var hrefArray = href.split('/').reverse();
|
15 |
-
var domain = hrefArray[2];
|
16 |
-
var downloadTracked = false;
|
17 |
-
|
18 |
-
// If the link is a download
|
19 |
-
if (jQuery.inArray(extension,analyticsFileTypes) != -1) {
|
20 |
-
// Mark the link as already tracked
|
21 |
-
downloadTracked = true;
|
22 |
-
|
23 |
-
// Add the tracking code
|
24 |
-
a.click(function() {
|
25 |
-
if ( analyticsEventTracking == 'enabled' ) {
|
26 |
-
_gaq.push(['_trackEvent', 'Downloads', extension.toUpperCase(), href]);
|
27 |
-
} else
|
28 |
-
_gaq.push(['_trackPageview', analyticsDownloadsPrefix + url]);
|
29 |
-
});
|
30 |
-
}
|
31 |
-
|
32 |
-
// If the link is external
|
33 |
-
if ( ( href.match(/^http/) ) && ( !href.match(document.domain) ) && ( downloadTracked == false ) ) {
|
34 |
-
// Add the tracking code
|
35 |
-
a.click(function() {
|
36 |
-
if ( analyticsEventTracking == 'enabled' ) {
|
37 |
-
_gaq.push(['_trackEvent', 'Outbound Traffic', href.match(/:\/\/(.[^/]+)/)[1], href]);
|
38 |
-
} else
|
39 |
-
_gaq.push(['_trackPageview', analyticsOutboundPrefix + url]);
|
40 |
-
});
|
41 |
-
}
|
42 |
-
});
|
43 |
-
|
44 |
});
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
|
3 |
+
jQuery('a').each(function() {
|
4 |
+
var a = jQuery(this);
|
5 |
+
var href = a.attr('href');
|
6 |
+
|
7 |
+
// Check if the a tag has a href, if not, stop for the current link
|
8 |
+
if ( href == undefined )
|
9 |
+
return;
|
10 |
+
|
11 |
+
var url = href.replace('http://','').replace('https://','');
|
12 |
+
var hrefArray = href.split('.').reverse();
|
13 |
+
var extension = hrefArray[0].toLowerCase();
|
14 |
+
var hrefArray = href.split('/').reverse();
|
15 |
+
var domain = hrefArray[2];
|
16 |
+
var downloadTracked = false;
|
17 |
+
|
18 |
+
// If the link is a download
|
19 |
+
if (jQuery.inArray(extension,analyticsFileTypes) != -1) {
|
20 |
+
// Mark the link as already tracked
|
21 |
+
downloadTracked = true;
|
22 |
+
|
23 |
+
// Add the tracking code
|
24 |
+
a.click(function() {
|
25 |
+
if ( analyticsEventTracking == 'enabled' ) {
|
26 |
+
_gaq.push(['_trackEvent', 'Downloads', extension.toUpperCase(), href]);
|
27 |
+
} else
|
28 |
+
_gaq.push(['_trackPageview', analyticsDownloadsPrefix + url]);
|
29 |
+
});
|
30 |
+
}
|
31 |
+
|
32 |
+
// If the link is external
|
33 |
+
if ( ( href.match(/^http/) ) && ( !href.match(document.domain) ) && ( downloadTracked == false ) ) {
|
34 |
+
// Add the tracking code
|
35 |
+
a.click(function() {
|
36 |
+
if ( analyticsEventTracking == 'enabled' ) {
|
37 |
+
_gaq.push(['_trackEvent', 'Outbound Traffic', href.match(/:\/\/(.[^/]+)/)[1], href]);
|
38 |
+
} else
|
39 |
+
_gaq.push(['_trackPageview', analyticsOutboundPrefix + url]);
|
40 |
+
});
|
41 |
+
}
|
42 |
+
});
|
43 |
+
|
44 |
});
|
external-tracking.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
jQuery(document).ready(function(){jQuery('a').each(function(){var a=jQuery(this);var href=a.attr('href');if(href==undefined)
|
2 |
-
return;var url=href.replace('http://','').replace('https://','');var hrefArray=href.split('.').reverse();var extension=hrefArray[0].toLowerCase();var hrefArray=href.split('/').reverse();var domain=hrefArray[2];var downloadTracked=false;if(jQuery.inArray(extension,analyticsFileTypes)!=-1){downloadTracked=true;a.click(function(){if(analyticsEventTracking=='enabled'){_gaq.push(['_trackEvent','Downloads',extension.toUpperCase(),href]);}else
|
3 |
-
_gaq.push(['_trackPageview',analyticsDownloadsPrefix+url]);});}
|
4 |
-
if((href.match(/^http/))&&(!href.match(document.domain))&&(downloadTracked==false)){a.click(function(){if(analyticsEventTracking=='enabled'){_gaq.push(['_trackEvent','Outbound Traffic',href.match(/:\/\/(.[^/]+)/)[1],href]);}else
|
5 |
_gaq.push(['_trackPageview',analyticsOutboundPrefix+url]);});}});});
|
1 |
+
jQuery(document).ready(function(){jQuery('a').each(function(){var a=jQuery(this);var href=a.attr('href');if(href==undefined)
|
2 |
+
return;var url=href.replace('http://','').replace('https://','');var hrefArray=href.split('.').reverse();var extension=hrefArray[0].toLowerCase();var hrefArray=href.split('/').reverse();var domain=hrefArray[2];var downloadTracked=false;if(jQuery.inArray(extension,analyticsFileTypes)!=-1){downloadTracked=true;a.click(function(){if(analyticsEventTracking=='enabled'){_gaq.push(['_trackEvent','Downloads',extension.toUpperCase(),href]);}else
|
3 |
+
_gaq.push(['_trackPageview',analyticsDownloadsPrefix+url]);});}
|
4 |
+
if((href.match(/^http/))&&(!href.match(document.domain))&&(downloadTracked==false)){a.click(function(){if(analyticsEventTracking=='enabled'){_gaq.push(['_trackEvent','Outbound Traffic',href.match(/:\/\/(.[^/]+)/)[1],href]);}else
|
5 |
_gaq.push(['_trackPageview',analyticsOutboundPrefix+url]);});}});});
|
google-analyticator.php
CHANGED
@@ -1,1037 +1,1050 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Plugin Name: Google Analyticator
|
4 |
-
* Version: 6.
|
5 |
-
* Plugin URI: http://
|
6 |
-
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin
|
7 |
-
* Author:
|
8 |
-
* Author URI: http://
|
9 |
-
* Text Domain: google-analyticator
|
10 |
-
*/
|
11 |
-
|
12 |
-
define('GOOGLE_ANALYTICATOR_VERSION', '6.
|
13 |
-
|
14 |
-
|
15 |
-
define
|
16 |
-
define
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
define("
|
21 |
-
define("
|
22 |
-
|
23 |
-
|
24 |
-
define("
|
25 |
-
define("
|
26 |
-
define("
|
27 |
-
define("
|
28 |
-
define("
|
29 |
-
define("
|
30 |
-
define("
|
31 |
-
define("
|
32 |
-
define("
|
33 |
-
define("
|
34 |
-
define("
|
35 |
-
|
36 |
-
define("
|
37 |
-
define("
|
38 |
-
define("
|
39 |
-
define("
|
40 |
-
|
41 |
-
define("
|
42 |
-
define("
|
43 |
-
define("
|
44 |
-
define("
|
45 |
-
define("
|
46 |
-
define("
|
47 |
-
define("
|
48 |
-
define("
|
49 |
-
define("
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
add_option(
|
59 |
-
add_option(
|
60 |
-
add_option(
|
61 |
-
add_option(
|
62 |
-
add_option(
|
63 |
-
add_option(
|
64 |
-
add_option(
|
65 |
-
add_option(
|
66 |
-
add_option
|
67 |
-
add_option(
|
68 |
-
add_option
|
69 |
-
add_option
|
70 |
-
add_option(
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
#
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
$
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
<tr>
|
416 |
-
<th width="30%" valign="top" style="padding-top: 10px;">
|
417 |
-
<label for="<?php echo
|
418 |
-
</th>
|
419 |
-
<td>
|
420 |
-
<?php
|
421 |
-
echo "<select name='".
|
422 |
-
|
423 |
-
echo "<option value='".ga_enabled."'";
|
424 |
-
if(get_option(
|
425 |
-
echo " selected='selected'";
|
426 |
-
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
427 |
-
|
428 |
-
echo "<option value='".ga_disabled."'";
|
429 |
-
if(get_option(
|
430 |
-
echo" selected='selected'";
|
431 |
-
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
432 |
-
|
433 |
-
echo "</select>\n";
|
434 |
-
?>
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
echo
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
echo "<
|
533 |
-
|
534 |
-
|
535 |
-
echo
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
echo
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
echo "<
|
561 |
-
|
562 |
-
|
563 |
-
echo
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
<
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
echo
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
echo
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
echo
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
echo
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
echo "<
|
642 |
-
|
643 |
-
|
644 |
-
echo
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
echo
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
echo
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
</
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
if
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
#
|
998 |
-
$
|
999 |
-
|
1000 |
-
#
|
1001 |
-
$
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
}
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1037 |
?>
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Plugin Name: Google Analyticator
|
4 |
+
* Version: 6.3.4
|
5 |
+
* Plugin URI: http://wordpress.org/extend/plugins/google-analyticator/
|
6 |
+
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin you need to authenticate with Google, then select your domain and you're set.
|
7 |
+
* Author: Video User Manuals
|
8 |
+
* Author URI: http://www.videousermanuals.com
|
9 |
+
* Text Domain: google-analyticator
|
10 |
+
*/
|
11 |
+
|
12 |
+
define('GOOGLE_ANALYTICATOR_VERSION', '6.3.4');
|
13 |
+
|
14 |
+
define('GOOGLE_ANALYTICATOR_CLIENTID', '1007949979410.apps.googleusercontent.com');
|
15 |
+
define('GOOGLE_ANALYTICATOR_CLIENTSECRET', 'q06U41XDXtzaXD14E-KO1hti'); //don't worry - this don't need to be secret in our case
|
16 |
+
define('GOOGLE_ANALYTICATOR_REDIRECT', 'urn:ietf:wg:oauth:2.0:oob');
|
17 |
+
define('GOOGLE_ANALYTICATOR_SCOPE', 'https://www.googleapis.com/auth/analytics.readonly');
|
18 |
+
|
19 |
+
// Constants for enabled/disabled state
|
20 |
+
define("ga_enabled", "enabled", true);
|
21 |
+
define("ga_disabled", "disabled", true);
|
22 |
+
|
23 |
+
// Defaults, etc.
|
24 |
+
define("key_ga_uid", "ga_uid", true);
|
25 |
+
define("key_ga_status", "ga_status", true);
|
26 |
+
define("key_ga_admin", "ga_admin_status", true);
|
27 |
+
define("key_ga_admin_disable", "ga_admin_disable", true);
|
28 |
+
define("key_ga_admin_role", "ga_admin_role", true);
|
29 |
+
define("key_ga_dashboard_role", "ga_dashboard_role", true);
|
30 |
+
define("key_ga_adsense", "ga_adsense", true);
|
31 |
+
define("key_ga_extra", "ga_extra", true);
|
32 |
+
define("key_ga_extra_after", "ga_extra_after", true);
|
33 |
+
define("key_ga_event", "ga_event", true);
|
34 |
+
define("key_ga_outbound", "ga_outbound", true);
|
35 |
+
define("key_ga_outbound_prefix", "ga_outbound_prefix", true);
|
36 |
+
define("key_ga_downloads", "ga_downloads", true);
|
37 |
+
define("key_ga_downloads_prefix", "ga_downloads_prefix", true);
|
38 |
+
define("key_ga_widgets", "ga_widgets", true);
|
39 |
+
define("key_ga_sitespeed", "ga_sitespeed", true);
|
40 |
+
|
41 |
+
define("ga_uid_default", "UA-XXXXXXXX-X", true);
|
42 |
+
define("ga_google_token_default", "", true);
|
43 |
+
define("ga_status_default", ga_disabled, true);
|
44 |
+
define("ga_admin_default", ga_enabled, true);
|
45 |
+
define("ga_admin_disable_default", 'remove', true);
|
46 |
+
define("ga_adsense_default", "", true);
|
47 |
+
define("ga_extra_default", "", true);
|
48 |
+
define("ga_extra_after_default", "", true);
|
49 |
+
define("ga_event_default", ga_enabled, true);
|
50 |
+
define("ga_outbound_default", ga_enabled, true);
|
51 |
+
define("ga_outbound_prefix_default", 'outgoing', true);
|
52 |
+
define("ga_downloads_default", "", true);
|
53 |
+
define("ga_downloads_prefix_default", "download", true);
|
54 |
+
define("ga_widgets_default", ga_enabled, true);
|
55 |
+
define("ga_sitespeed_default", ga_enabled, true);
|
56 |
+
|
57 |
+
// Create the default key and status
|
58 |
+
add_option(key_ga_status, ga_status_default, '');
|
59 |
+
add_option(key_ga_uid, ga_uid_default, '');
|
60 |
+
add_option(key_ga_admin, ga_admin_default, '');
|
61 |
+
add_option(key_ga_admin_disable, ga_admin_disable_default, '');
|
62 |
+
add_option(key_ga_admin_role, array('administrator'), '');
|
63 |
+
add_option(key_ga_dashboard_role, array('administrator'), '');
|
64 |
+
add_option(key_ga_adsense, ga_adsense_default, '');
|
65 |
+
add_option(key_ga_extra, ga_extra_default, '');
|
66 |
+
add_option(key_ga_extra_after, ga_extra_after_default, '');
|
67 |
+
add_option(key_ga_event, ga_event_default, '');
|
68 |
+
add_option(key_ga_outbound, ga_outbound_default, '');
|
69 |
+
add_option(key_ga_outbound_prefix, ga_outbound_prefix_default, '');
|
70 |
+
add_option(key_ga_downloads, ga_downloads_default, '');
|
71 |
+
add_option(key_ga_downloads_prefix, ga_downloads_prefix_default, '');
|
72 |
+
add_option(key_ga_sitespeed, ga_sitespeed_default, '');
|
73 |
+
add_option(key_ga_widgets, ga_widgets_default, '');
|
74 |
+
add_option('ga_defaults', 'yes' );
|
75 |
+
add_option('ga_google_token', '', '');
|
76 |
+
|
77 |
+
|
78 |
+
$useAuth = ( get_option( 'ga_google_token' ) == '' ? false : true );
|
79 |
+
|
80 |
+
|
81 |
+
# Check if we have a version of WordPress greater than 2.8
|
82 |
+
if ( function_exists('register_widget') ) {
|
83 |
+
|
84 |
+
# Check if widgets are enabled and the auth has been set!
|
85 |
+
if ( get_option(key_ga_widgets) == 'enabled' && $useAuth ) {
|
86 |
+
|
87 |
+
# Include Google Analytics Stats widget
|
88 |
+
require_once('google-analytics-stats-widget.php');
|
89 |
+
|
90 |
+
# Include the Google Analytics Summary widget
|
91 |
+
require_once('google-analytics-summary-widget.php');
|
92 |
+
$google_analytics_summary = new GoogleAnalyticsSummary();
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
// Create a option page for settings
|
99 |
+
add_action('admin_init', 'ga_admin_init');
|
100 |
+
add_action('admin_menu', 'add_ga_option_page');
|
101 |
+
|
102 |
+
// Initialize the options
|
103 |
+
function ga_admin_init() {
|
104 |
+
# Load the localization information
|
105 |
+
$plugin_dir = basename(dirname(__FILE__));
|
106 |
+
load_plugin_textdomain('google-analyticator', 'wp-content/plugins/' . $plugin_dir . '/localizations', $plugin_dir . '/localizations');
|
107 |
+
}
|
108 |
+
|
109 |
+
# Add the core Google Analytics script, with a high priority to ensure last script for async tracking
|
110 |
+
add_action('wp_head', 'add_google_analytics', 999999);
|
111 |
+
add_action('login_head', 'add_google_analytics', 999999);
|
112 |
+
|
113 |
+
# Initialize outbound link tracking
|
114 |
+
add_action('init', 'ga_outgoing_links');
|
115 |
+
|
116 |
+
// Hook in the options page function
|
117 |
+
function add_ga_option_page() {
|
118 |
+
|
119 |
+
$plugin_page = add_options_page(__('Google Analyticator Settings', 'google-analyticator'), 'Google Analytics', 'manage_options', basename(__FILE__), 'ga_options_page');
|
120 |
+
add_action('load-'.$plugin_page, 'ga_pre_load' );
|
121 |
+
|
122 |
+
$activate_page = add_submenu_page( null, 'Activation', 'Google Analytics', 'manage_options', 'ga_activate' , 'ga_activate');
|
123 |
+
|
124 |
+
|
125 |
+
$reset_page = add_submenu_page(null, 'Reset', 'Reset', 'activate_plugins', 'ga_reset', 'ga_reset' );
|
126 |
+
add_action('load-'.$reset_page, 'ga_do_reset' );
|
127 |
+
|
128 |
+
}
|
129 |
+
|
130 |
+
add_action('plugin_action_links_' . plugin_basename(__FILE__), 'ga_filter_plugin_actions');
|
131 |
+
|
132 |
+
function ga_pre_load()
|
133 |
+
{
|
134 |
+
|
135 |
+
if( isset( $_POST['key_ga_google_token'] ) ):
|
136 |
+
|
137 |
+
check_admin_referer('google-analyticator-update_settings');
|
138 |
+
|
139 |
+
// Nolonger defaults
|
140 |
+
update_option('ga_defaults', 'no');
|
141 |
+
|
142 |
+
// Update GA Token
|
143 |
+
update_option('ga_google_token', $_POST['key_ga_google_token']);
|
144 |
+
|
145 |
+
|
146 |
+
endif;
|
147 |
+
|
148 |
+
if( get_option('ga_defaults') == 'yes' ):
|
149 |
+
|
150 |
+
wp_redirect( admin_url('options-general.php?page=ga_activate') );
|
151 |
+
exit;
|
152 |
+
|
153 |
+
endif;
|
154 |
+
}
|
155 |
+
|
156 |
+
function ga_activate()
|
157 |
+
{
|
158 |
+
|
159 |
+
if (! function_exists('curl_init')) {
|
160 |
+
print('Google PHP API Client requires the CURL PHP extension');
|
161 |
+
return;
|
162 |
+
}
|
163 |
+
|
164 |
+
if (! function_exists('json_decode')) {
|
165 |
+
print('Google PHP API Client requires the JSON PHP extension');
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
|
169 |
+
if (! function_exists('http_build_query')) {
|
170 |
+
print('Google PHP API Client requires http_build_query()');
|
171 |
+
return;
|
172 |
+
}
|
173 |
+
|
174 |
+
$url = http_build_query( array(
|
175 |
+
'next' => admin_url('/options-general.php?page=google-analyticator.php'),
|
176 |
+
'scope' => GOOGLE_ANALYTICATOR_SCOPE,
|
177 |
+
'response_type'=>'code',
|
178 |
+
'redirect_uri'=>GOOGLE_ANALYTICATOR_REDIRECT,
|
179 |
+
'client_id'=>GOOGLE_ANALYTICATOR_CLIENTID
|
180 |
+
)
|
181 |
+
);
|
182 |
+
|
183 |
+
?>
|
184 |
+
<div class="wrap">
|
185 |
+
|
186 |
+
<h2>Activate Google Analyticator</h2>
|
187 |
+
|
188 |
+
<p><strong>Google Authentication Code </strong> </p>
|
189 |
+
|
190 |
+
<p>You need to sign in to Google and grant this plugin access to your Google Analytics account</p>
|
191 |
+
|
192 |
+
<p>
|
193 |
+
<a
|
194 |
+
onclick="window.open('https://accounts.google.com/o/oauth2/auth?<?php echo $url ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"
|
195 |
+
target="_blank"
|
196 |
+
href="javascript:void(0);"> Click Here </a> - <small> Or <a target="_blank" href="https://accounts.google.com/o/oauth2/auth?<?php echo $url ?>">here</a> if you have popups blocked</small>
|
197 |
+
</p>
|
198 |
+
|
199 |
+
<div id="key">
|
200 |
+
|
201 |
+
<p>Enter your Google Authentication Code in this box. This code will be used to get an Authentication Token so you can access your website stats.</p>
|
202 |
+
<form method="post" action="<?php echo admin_url('options-general.php?page=google-analyticator.php');?>">
|
203 |
+
<?php wp_nonce_field('google-analyticator-update_settings'); ?>
|
204 |
+
<input type="text" name="key_ga_google_token" value="" style="width:450px;"/>
|
205 |
+
<input type="submit" value="Save & Continue" />
|
206 |
+
</form>
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<br /><br /><br />
|
210 |
+
<hr />
|
211 |
+
<br />
|
212 |
+
|
213 |
+
<p><strong>I Don't Want To Authenticate Through Google </strong> </p>
|
214 |
+
|
215 |
+
<p>If you don't want to authenticate through Google and only use the tracking capability of the plugin (<strong><u>not the dashboard functionality</u></strong>), you can do this by clicking the button below. </p>
|
216 |
+
<p>You will be asked on the next page to manually enter your Google Analytics UID.</p>
|
217 |
+
<form method="post" action="<?php echo admin_url('options-general.php?page=google-analyticator.php');?>">
|
218 |
+
<input type="hidden" name="key_ga_google_token" value="" />
|
219 |
+
<?php wp_nonce_field('google-analyticator-update_settings'); ?>
|
220 |
+
<input type="submit" value="Continue Without Authentication" />
|
221 |
+
</form>
|
222 |
+
|
223 |
+
|
224 |
+
</div>
|
225 |
+
|
226 |
+
<?php
|
227 |
+
}
|
228 |
+
|
229 |
+
// Add settings option
|
230 |
+
function ga_filter_plugin_actions($links) {
|
231 |
+
$new_links = array();
|
232 |
+
|
233 |
+
$new_links[] = '<a href="' . admin_url('options-general.php?page=google-analyticator.php').'">' . __('Settings', 'google-analyticator') . '</a>';
|
234 |
+
$new_links[] = '<a href="' . admin_url('options-general.php?page=ga_reset">') . __('Reset', 'google-analyticator') . '</a>';
|
235 |
+
|
236 |
+
return array_merge($new_links, $links);
|
237 |
+
}
|
238 |
+
|
239 |
+
function ga_do_reset()
|
240 |
+
{
|
241 |
+
// Delete all GA options.
|
242 |
+
delete_option(key_ga_status);
|
243 |
+
delete_option(key_ga_uid);
|
244 |
+
delete_option(key_ga_admin);
|
245 |
+
delete_option(key_ga_admin_disable);
|
246 |
+
delete_option(key_ga_admin_role);
|
247 |
+
delete_option(key_ga_dashboard_role);
|
248 |
+
delete_option(key_ga_adsense);
|
249 |
+
delete_option(key_ga_extra);
|
250 |
+
delete_option(key_ga_extra_after);
|
251 |
+
delete_option(key_ga_event);
|
252 |
+
delete_option(key_ga_outbound);
|
253 |
+
delete_option(key_ga_outbound_prefix);
|
254 |
+
delete_option(key_ga_downloads);
|
255 |
+
delete_option(key_ga_downloads_prefix);
|
256 |
+
delete_option(key_ga_sitespeed);
|
257 |
+
delete_option(key_ga_widgets);
|
258 |
+
delete_option('ga_defaults');
|
259 |
+
delete_option('ga_google_token');
|
260 |
+
delete_option('ga_google_authtoken');
|
261 |
+
delete_option('ga_profileid');
|
262 |
+
|
263 |
+
|
264 |
+
|
265 |
+
wp_redirect( admin_url( 'options-general.php?page=ga_activate' ) );
|
266 |
+
exit;
|
267 |
+
}
|
268 |
+
|
269 |
+
function ga_reset(){ /* Wont ever run. */ }
|
270 |
+
|
271 |
+
|
272 |
+
function ga_options_page() {
|
273 |
+
|
274 |
+
// If we are a postback, store the options
|
275 |
+
if (isset($_POST['info_update'])) {
|
276 |
+
# Verify nonce
|
277 |
+
check_admin_referer('google-analyticator-update_settings');
|
278 |
+
|
279 |
+
update_option('ga_defaults', 'no');
|
280 |
+
|
281 |
+
|
282 |
+
// Update the status
|
283 |
+
$ga_status = $_POST[key_ga_status];
|
284 |
+
if (($ga_status != ga_enabled) && ($ga_status != ga_disabled))
|
285 |
+
$ga_status = ga_status_default;
|
286 |
+
update_option(key_ga_status, $ga_status);
|
287 |
+
|
288 |
+
// Update the UID
|
289 |
+
$ga_uid = $_POST[key_ga_uid];
|
290 |
+
if ($ga_uid == '')
|
291 |
+
$ga_uid = ga_uid_default;
|
292 |
+
update_option(key_ga_uid, $ga_uid);
|
293 |
+
|
294 |
+
// Update the admin logging
|
295 |
+
$ga_admin = $_POST[key_ga_admin];
|
296 |
+
if (($ga_admin != ga_enabled) && ($ga_admin != ga_disabled))
|
297 |
+
$ga_admin = ga_admin_default;
|
298 |
+
update_option(key_ga_admin, $ga_admin);
|
299 |
+
|
300 |
+
// Update the admin disable setting
|
301 |
+
$ga_admin_disable = $_POST[key_ga_admin_disable];
|
302 |
+
if ( $ga_admin_disable == '' )
|
303 |
+
$ga_admin_disable = ga_admin_disable_default;
|
304 |
+
update_option(key_ga_admin_disable, $ga_admin_disable);
|
305 |
+
|
306 |
+
// Update the admin level
|
307 |
+
if ( array_key_exists(key_ga_admin_role, $_POST) ) {
|
308 |
+
$ga_admin_role = $_POST[key_ga_admin_role];
|
309 |
+
} else {
|
310 |
+
$ga_admin_role = "";
|
311 |
+
}
|
312 |
+
update_option(key_ga_admin_role, $ga_admin_role);
|
313 |
+
|
314 |
+
// Update the dashboard level
|
315 |
+
if ( array_key_exists(key_ga_dashboard_role, $_POST) ) {
|
316 |
+
$ga_dashboard_role = $_POST[key_ga_dashboard_role];
|
317 |
+
} else {
|
318 |
+
$ga_dashboard_role = "";
|
319 |
+
}
|
320 |
+
update_option(key_ga_dashboard_role, $ga_dashboard_role);
|
321 |
+
|
322 |
+
// Update the extra tracking code
|
323 |
+
$ga_extra = $_POST[key_ga_extra];
|
324 |
+
update_option(key_ga_extra, $ga_extra);
|
325 |
+
|
326 |
+
// Update the extra after tracking code
|
327 |
+
$ga_extra_after = $_POST[key_ga_extra_after];
|
328 |
+
update_option(key_ga_extra_after, $ga_extra_after);
|
329 |
+
|
330 |
+
// Update the adsense key
|
331 |
+
$ga_adsense = $_POST[key_ga_adsense];
|
332 |
+
update_option(key_ga_adsense, $ga_adsense);
|
333 |
+
|
334 |
+
// Update the event tracking
|
335 |
+
$ga_event = $_POST[key_ga_event];
|
336 |
+
if (($ga_event != ga_enabled) && ($ga_event != ga_disabled))
|
337 |
+
$ga_event = ga_event_default;
|
338 |
+
update_option(key_ga_event, $ga_event);
|
339 |
+
|
340 |
+
// Update the outbound tracking
|
341 |
+
$ga_outbound = $_POST[key_ga_outbound];
|
342 |
+
if (($ga_outbound != ga_enabled) && ($ga_outbound != ga_disabled))
|
343 |
+
$ga_outbound = ga_outbound_default;
|
344 |
+
update_option(key_ga_outbound, $ga_outbound);
|
345 |
+
|
346 |
+
// Update the outbound prefix
|
347 |
+
$ga_outbound_prefix = $_POST[key_ga_outbound_prefix];
|
348 |
+
if ($ga_outbound_prefix == '')
|
349 |
+
$ga_outbound_prefix = ga_outbound_prefix_default;
|
350 |
+
update_option(key_ga_outbound_prefix, $ga_outbound_prefix);
|
351 |
+
|
352 |
+
// Update the download tracking code
|
353 |
+
$ga_downloads = $_POST[key_ga_downloads];
|
354 |
+
update_option(key_ga_downloads, $ga_downloads);
|
355 |
+
|
356 |
+
// Update the download prefix
|
357 |
+
$ga_downloads_prefix = $_POST[key_ga_downloads_prefix];
|
358 |
+
if ($ga_downloads_prefix == '')
|
359 |
+
$ga_downloads_prefix = ga_downloads_prefix_default;
|
360 |
+
update_option(key_ga_downloads_prefix, $ga_downloads_prefix);
|
361 |
+
|
362 |
+
// Update the widgets option
|
363 |
+
$ga_widgets = $_POST[key_ga_widgets];
|
364 |
+
if (($ga_widgets != ga_enabled) && ($ga_widgets != ga_disabled))
|
365 |
+
$ga_widgets = ga_widgets_default;
|
366 |
+
update_option(key_ga_widgets, $ga_widgets);
|
367 |
+
|
368 |
+
|
369 |
+
// Update the sitespeed option
|
370 |
+
$ga_sitespeed = $_POST[key_ga_sitespeed];
|
371 |
+
if (($ga_sitespeed != ga_enabled) && ($ga_sitespeed != ga_disabled))
|
372 |
+
$ga_sitespeed = ga_widgets_default;
|
373 |
+
update_option(key_ga_sitespeed, $ga_sitespeed);
|
374 |
+
|
375 |
+
// Give an updated message
|
376 |
+
echo "<div class='updated fade'><p><strong>" . __('Google Analyticator settings saved.', 'google-analyticator') . "</strong></p></div>";
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
+
// Are we using the auth system?
|
381 |
+
$useAuth = ( get_option( 'ga_google_token' ) == '' ? false : true );
|
382 |
+
|
383 |
+
|
384 |
+
// Output the options page
|
385 |
+
?>
|
386 |
+
|
387 |
+
<div class="wrap">
|
388 |
+
|
389 |
+
<h2><?php _e('Google Analyticator Settings', 'google-analyticator'); ?></h2>
|
390 |
+
|
391 |
+
<form method="post" action="<?php echo admin_url('options-general.php?page=google-analyticator.php');?>">
|
392 |
+
<?php
|
393 |
+
# Add a nonce
|
394 |
+
wp_nonce_field('google-analyticator-update_settings');
|
395 |
+
?>
|
396 |
+
|
397 |
+
<?php if (get_option(key_ga_status) == ga_disabled) { ?>
|
398 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
399 |
+
<?php _e('Google Analytics integration is currently <strong>DISABLED</strong>.', 'google-analyticator'); ?>
|
400 |
+
</div>
|
401 |
+
<?php } ?>
|
402 |
+
<?php if ((get_option(key_ga_uid) == "XX-XXXXX-X") && (get_option(key_ga_status) != ga_disabled)) { ?>
|
403 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
404 |
+
<?php _e('Google Analytics integration is currently enabled, but you did not enter a UID. Tracking will not occur.', 'google-analyticator'); ?>
|
405 |
+
</div>
|
406 |
+
<?php } ?>
|
407 |
+
<table class="form-table" cellspacing="2" cellpadding="5" width="100%">
|
408 |
+
|
409 |
+
<tr>
|
410 |
+
<td colspan="2">
|
411 |
+
<h3><?php _e('Basic Settings', 'google-analyticator'); ?></h3>
|
412 |
+
</td>
|
413 |
+
</tr>
|
414 |
+
|
415 |
+
<tr>
|
416 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
417 |
+
<label for="<?php echo key_ga_status ?>"><?php _e('Google Analytics logging is', 'google-analyticator'); ?>:</label>
|
418 |
+
</th>
|
419 |
+
<td>
|
420 |
+
<?php
|
421 |
+
echo "<select name='".key_ga_status."' id='".key_ga_status."'>\n";
|
422 |
+
|
423 |
+
echo "<option value='".ga_enabled."'";
|
424 |
+
if(get_option(key_ga_status) == ga_enabled)
|
425 |
+
echo " selected='selected'";
|
426 |
+
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
427 |
+
|
428 |
+
echo "<option value='".ga_disabled."'";
|
429 |
+
if(get_option(key_ga_status) == ga_disabled)
|
430 |
+
echo" selected='selected'";
|
431 |
+
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
432 |
+
|
433 |
+
echo "</select>\n";
|
434 |
+
?>
|
435 |
+
</td>
|
436 |
+
</tr>
|
437 |
+
<tr id="ga_ajax_accounts">
|
438 |
+
<th valign="top" style="padding-top: 10px;">
|
439 |
+
<label for="<?php echo key_ga_uid; ?>"><?php _e('Google Analytics UID', 'google-analyticator'); ?>:</label>
|
440 |
+
</th>
|
441 |
+
<td>
|
442 |
+
<?php
|
443 |
+
|
444 |
+
if( $useAuth ):
|
445 |
+
|
446 |
+
$uids = ga_get_analytics_accounts();
|
447 |
+
|
448 |
+
echo "<select name='".key_ga_uid."'> ";
|
449 |
+
|
450 |
+
foreach($uids as $id=>$domain):
|
451 |
+
|
452 |
+
echo '<option value="'.$id.'"';
|
453 |
+
// If set in DB.
|
454 |
+
if( get_option(key_ga_uid) == $id ) { echo ' selected="selected"'; }
|
455 |
+
// Else if the domain matches the current domain & nothing set in DB.
|
456 |
+
elseif( $_SERVER['HTTP_HOST'] == $domain && ( get_option(key_ga_uid) != '' ) ) { echo ' selected="selected"'; }
|
457 |
+
echo '>'.$domain.'</option>';
|
458 |
+
|
459 |
+
endforeach;
|
460 |
+
|
461 |
+
echo '</select>';
|
462 |
+
|
463 |
+
else:
|
464 |
+
|
465 |
+
echo '<input type="text" name="'.key_ga_uid.'" value="'. get_option( key_ga_uid ) .'" />';
|
466 |
+
|
467 |
+
endif;
|
468 |
+
?>
|
469 |
+
</td>
|
470 |
+
</tr>
|
471 |
+
<tr>
|
472 |
+
<td colspan="2">
|
473 |
+
<h3><?php _e('Tracking Settings', 'google-analyticator'); ?></h3>
|
474 |
+
</td>
|
475 |
+
</tr>
|
476 |
+
<tr>
|
477 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
478 |
+
<label for="<?php echo key_ga_admin ?>"><?php _e('Track all logged in WordPress users', 'google-analyticator'); ?>:</label>
|
479 |
+
</th>
|
480 |
+
<td>
|
481 |
+
<?php
|
482 |
+
echo "<select name='".key_ga_admin."' id='".key_ga_admin."'>\n";
|
483 |
+
|
484 |
+
echo "<option value='".ga_enabled."'";
|
485 |
+
if(get_option(key_ga_admin) == ga_enabled)
|
486 |
+
echo " selected='selected'";
|
487 |
+
echo ">" . __('Yes', 'google-analyticator') . "</option>\n";
|
488 |
+
|
489 |
+
echo "<option value='".ga_disabled."'";
|
490 |
+
if(get_option(key_ga_admin) == ga_disabled)
|
491 |
+
echo" selected='selected'";
|
492 |
+
echo ">" . __('No', 'google-analyticator') . "</option>\n";
|
493 |
+
|
494 |
+
echo "</select>\n";
|
495 |
+
|
496 |
+
?>
|
497 |
+
<p class="setting-description"><?php _e('Selecting "no" to this option will prevent logged in WordPress users from showing up on your Google Analytics reports. This setting will prevent yourself or other users from showing up in your Analytics reports. Use the next setting to determine what user groups to exclude.', 'google-analyticator'); ?></p>
|
498 |
+
</td>
|
499 |
+
</tr>
|
500 |
+
<tr>
|
501 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
502 |
+
<label for="<?php echo key_ga_admin_role ?>"><?php _e('User roles to not track', 'google-analyticator'); ?>:</label>
|
503 |
+
</th>
|
504 |
+
<td>
|
505 |
+
<?php
|
506 |
+
global $wp_roles;
|
507 |
+
$roles = $wp_roles->get_names();
|
508 |
+
$selected_roles = get_option(key_ga_admin_role);
|
509 |
+
if ( !is_array($selected_roles) ) $selected_roles = array();
|
510 |
+
|
511 |
+
# Loop through the roles
|
512 |
+
foreach ( $roles AS $role => $name ) {
|
513 |
+
echo '<input type="checkbox" value="' . $role . '" name="' . key_ga_admin_role . '[]"';
|
514 |
+
if ( in_array($role, $selected_roles) )
|
515 |
+
echo " checked='checked'";
|
516 |
+
$name_pos = strpos($name, '|');
|
517 |
+
$name = ( $name_pos ) ? substr($name, 0, $name_pos) : $name;
|
518 |
+
echo ' /> ' . _x($name, 'User role') . '<br />';
|
519 |
+
}
|
520 |
+
?>
|
521 |
+
<p class="setting-description"><?php _e('Specifies the user roles to not include in your WordPress Analytics report. If a user is logged into WordPress with one of these roles, they will not show up in your Analytics report.', 'google-analyticator'); ?></p>
|
522 |
+
</td>
|
523 |
+
</tr>
|
524 |
+
<tr>
|
525 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
526 |
+
<label for="<?php echo key_ga_admin_disable ?>"><?php _e('Method to prevent tracking', 'google-analyticator'); ?>:</label>
|
527 |
+
</th>
|
528 |
+
<td>
|
529 |
+
<?php
|
530 |
+
echo "<select name='".key_ga_admin_disable."' id='".key_ga_admin_disable."'>\n";
|
531 |
+
|
532 |
+
echo "<option value='remove'";
|
533 |
+
if(get_option(key_ga_admin_disable) == 'remove')
|
534 |
+
echo " selected='selected'";
|
535 |
+
echo ">" . __('Remove', 'google-analyticator') . "</option>\n";
|
536 |
+
|
537 |
+
echo "<option value='admin'";
|
538 |
+
if(get_option(key_ga_admin_disable) == 'admin')
|
539 |
+
echo" selected='selected'";
|
540 |
+
echo ">" . __('Use \'admin\' variable', 'google-analyticator') . "</option>\n";
|
541 |
+
|
542 |
+
echo "</select>\n";
|
543 |
+
?>
|
544 |
+
<p class="setting-description"><?php _e('Selecting the "Remove" option will physically remove the tracking code from logged in users. Selecting the "Use \'admin\' variable" option will assign a variable called \'admin\' to logged in users. This option will allow Google Analytics\' site overlay feature to work, but you will have to manually configure Google Analytics to exclude tracking from pageviews with the \'admin\' variable.', 'google-analyticator'); ?></p>
|
545 |
+
</td>
|
546 |
+
</tr>
|
547 |
+
<tr>
|
548 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
549 |
+
<label for="<?php echo key_ga_sitespeed ?>"><?php _e('Site speed tracking', 'google-analyticator'); ?>:</label>
|
550 |
+
</th>
|
551 |
+
<td>
|
552 |
+
<?php
|
553 |
+
echo "<select name='".key_ga_sitespeed."' id='".key_ga_sitespeed."'>\n";
|
554 |
+
|
555 |
+
echo "<option value='".ga_enabled."'";
|
556 |
+
if(get_option(key_ga_sitespeed) == ga_enabled)
|
557 |
+
echo " selected='selected'";
|
558 |
+
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
559 |
+
|
560 |
+
echo "<option value='".ga_disabled."'";
|
561 |
+
if(get_option(key_ga_sitespeed) == ga_disabled)
|
562 |
+
echo" selected='selected'";
|
563 |
+
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
564 |
+
|
565 |
+
echo "</select>\n";
|
566 |
+
?>
|
567 |
+
<p class="setting-description"><?php _e('Disabling this option will turn off the tracking required for <a href="http://www.google.com/support/analyticshelp/bin/answer.py?hl=en&answer=1205784&topic=1120718&utm_source=gablog&utm_medium=blog&utm_campaign=newga-blog&utm_content=sitespeed">Google Analytics\' Site Speed tracking report</a>.', 'google-analyticator'); ?></p>
|
568 |
+
</td>
|
569 |
+
</tr>
|
570 |
+
<tr>
|
571 |
+
<td colspan="2">
|
572 |
+
<h3>Link Tracking Settings</h3>
|
573 |
+
</td>
|
574 |
+
</tr>
|
575 |
+
<tr>
|
576 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
577 |
+
<label for="<?php echo key_ga_outbound ?>"><?php _e('Outbound link tracking', 'google-analyticator'); ?>:</label>
|
578 |
+
</th>
|
579 |
+
<td>
|
580 |
+
<?php
|
581 |
+
echo "<select name='".key_ga_outbound."' id='".key_ga_outbound."'>\n";
|
582 |
+
|
583 |
+
echo "<option value='".ga_enabled."'";
|
584 |
+
if(get_option(key_ga_outbound) == ga_enabled)
|
585 |
+
echo " selected='selected'";
|
586 |
+
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
587 |
+
|
588 |
+
echo "<option value='".ga_disabled."'";
|
589 |
+
if(get_option(key_ga_outbound) == ga_disabled)
|
590 |
+
echo" selected='selected'";
|
591 |
+
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
592 |
+
|
593 |
+
echo "</select>\n";
|
594 |
+
?>
|
595 |
+
<p class="setting-description"><?php _e('Disabling this option will turn off the tracking of outbound links. It\'s recommended not to disable this option unless you\'re a privacy advocate (now why would you be using Google Analytics in the first place?) or it\'s causing some kind of weird issue.', 'google-analyticator'); ?></p>
|
596 |
+
</td>
|
597 |
+
</tr>
|
598 |
+
<tr>
|
599 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
600 |
+
<label for="<?php echo key_ga_event ?>"><?php _e('Event tracking', 'google-analyticator'); ?>:</label>
|
601 |
+
</th>
|
602 |
+
<td>
|
603 |
+
<?php
|
604 |
+
echo "<select name='".key_ga_event."' id='".key_ga_event."'>\n";
|
605 |
+
|
606 |
+
echo "<option value='".ga_enabled."'";
|
607 |
+
if(get_option(key_ga_event) == ga_enabled)
|
608 |
+
echo " selected='selected'";
|
609 |
+
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
610 |
+
|
611 |
+
echo "<option value='".ga_disabled."'";
|
612 |
+
if(get_option(key_ga_event) == ga_disabled)
|
613 |
+
echo" selected='selected'";
|
614 |
+
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
615 |
+
|
616 |
+
echo "</select>\n";
|
617 |
+
?>
|
618 |
+
<p class="setting-description"><?php _e('Enabling this option will treat outbound links and downloads as events instead of pageviews. Since the introduction of <a href="https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide">event tracking in Analytics</a>, this is the recommended way to track these types of actions. Only disable this option if you must use the old pageview tracking method.', 'google-analyticator'); ?></p>
|
619 |
+
</td>
|
620 |
+
</tr>
|
621 |
+
<tr>
|
622 |
+
<th valign="top" style="padding-top: 10px;">
|
623 |
+
<label for="<?php echo key_ga_downloads; ?>"><?php _e('Download extensions to track', 'google-analyticator'); ?>:</label>
|
624 |
+
</th>
|
625 |
+
<td>
|
626 |
+
<?php
|
627 |
+
echo "<input type='text' size='50' ";
|
628 |
+
echo "name='".key_ga_downloads."' ";
|
629 |
+
echo "id='".key_ga_downloads."' ";
|
630 |
+
echo "value='".stripslashes(get_option(key_ga_downloads))."' />\n";
|
631 |
+
?>
|
632 |
+
<p class="setting-description"><?php _e('Enter any extensions of files you would like to be tracked as a download. For example to track all MP3s and PDFs enter <strong>mp3,pdf</strong>. <em>Outbound link tracking must be enabled for downloads to be tracked.</em>', 'google-analyticator'); ?></p>
|
633 |
+
</td>
|
634 |
+
</tr>
|
635 |
+
<tr>
|
636 |
+
<th valign="top" style="padding-top: 10px;">
|
637 |
+
<label for="<?php echo key_ga_outbound_prefix; ?>"><?php _e('Prefix external links with', 'google-analyticator'); ?>:</label>
|
638 |
+
</th>
|
639 |
+
<td>
|
640 |
+
<?php
|
641 |
+
echo "<input type='text' size='50' ";
|
642 |
+
echo "name='".key_ga_outbound_prefix."' ";
|
643 |
+
echo "id='".key_ga_outbound_prefix."' ";
|
644 |
+
echo "value='".stripslashes(get_option(key_ga_outbound_prefix))."' />\n";
|
645 |
+
?>
|
646 |
+
<p class="setting-description"><?php _e('Enter a name for the section tracked external links will appear under. This option has no effect if event tracking is enabled.', 'google-analyticator'); ?></em></p>
|
647 |
+
</td>
|
648 |
+
</tr>
|
649 |
+
<tr>
|
650 |
+
<th valign="top" style="padding-top: 10px;">
|
651 |
+
<label for="<?php echo key_ga_downloads_prefix; ?>"><?php _e('Prefix download links with', 'google-analyticator'); ?>:</label>
|
652 |
+
</th>
|
653 |
+
<td>
|
654 |
+
<?php
|
655 |
+
echo "<input type='text' size='50' ";
|
656 |
+
echo "name='".key_ga_downloads_prefix."' ";
|
657 |
+
echo "id='".key_ga_downloads_prefix."' ";
|
658 |
+
echo "value='".stripslashes(get_option(key_ga_downloads_prefix))."' />\n";
|
659 |
+
?>
|
660 |
+
<p class="setting-description"><?php _e('Enter a name for the section tracked download links will appear under. This option has no effect if event tracking is enabled.', 'google-analyticator'); ?></em></p>
|
661 |
+
</td>
|
662 |
+
</tr>
|
663 |
+
<tr>
|
664 |
+
<th valign="top" style="padding-top: 10px;">
|
665 |
+
<label for="<?php echo key_ga_adsense; ?>"><?php _e('Google Adsense ID', 'google-analyticator'); ?>:</label>
|
666 |
+
</th>
|
667 |
+
<td>
|
668 |
+
<?php
|
669 |
+
echo "<input type='text' size='50' ";
|
670 |
+
echo "name='".key_ga_adsense."' ";
|
671 |
+
echo "id='".key_ga_adsense."' ";
|
672 |
+
echo "value='".get_option(key_ga_adsense)."' />\n";
|
673 |
+
?>
|
674 |
+
<p class="setting-description"><?php _e('Enter your Google Adsense ID assigned by Google Analytics in this box. This enables Analytics tracking of Adsense information if your Adsense and Analytics accounts are linked.', 'google-analyticator'); ?></p>
|
675 |
+
</td>
|
676 |
+
</tr>
|
677 |
+
<tr>
|
678 |
+
<td colspan="2">
|
679 |
+
<h3>Additional Tracking Code </h3>
|
680 |
+
</td>
|
681 |
+
</tr>
|
682 |
+
<tr>
|
683 |
+
<th valign="top" style="padding-top: 10px;">
|
684 |
+
<label for="<?php echo key_ga_extra; ?>"><?php _e('Additional tracking code', 'google-analyticator'); ?><br />(<?php _e('before tracker initialization', 'google-analyticator'); ?>):</label>
|
685 |
+
</th>
|
686 |
+
<td>
|
687 |
+
<?php
|
688 |
+
echo "<textarea cols='50' rows='8' ";
|
689 |
+
echo "name='".key_ga_extra."' ";
|
690 |
+
echo "id='".key_ga_extra."'>";
|
691 |
+
echo stripslashes(get_option(key_ga_extra))."</textarea>\n";
|
692 |
+
?>
|
693 |
+
<p class="setting-description"><?php _e('Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>before</strong> the Google Analytics tracker is initialized.', 'google-analyticator'); ?></p>
|
694 |
+
</td>
|
695 |
+
</tr>
|
696 |
+
<tr>
|
697 |
+
<th valign="top" style="padding-top: 10px;">
|
698 |
+
<label for="<?php echo key_ga_extra_after; ?>"><?php _e('Additional tracking code', 'google-analyticator'); ?><br />(<?php _e('after tracker initialization', 'google-analyticator'); ?>):</label>
|
699 |
+
</th>
|
700 |
+
<td>
|
701 |
+
<?php
|
702 |
+
echo "<textarea cols='50' rows='8' ";
|
703 |
+
echo "name='".key_ga_extra_after."' ";
|
704 |
+
echo "id='".key_ga_extra_after."'>";
|
705 |
+
echo stripslashes(get_option(key_ga_extra_after))."</textarea>\n";
|
706 |
+
?>
|
707 |
+
<p class="setting-description"><?php _e('Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized.', 'google-analyticator'); ?></p>
|
708 |
+
</td>
|
709 |
+
</tr>
|
710 |
+
<tr>
|
711 |
+
<td colspan="2">
|
712 |
+
<h3>Admin Dashboard Widgets</h3>
|
713 |
+
<?php if(!$useAuth): ?>
|
714 |
+
<div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
|
715 |
+
<?php _e('You have not authenticated with Google - you cannot use dashboard widgets! Reset the plugin to authenticate..', 'google-analyticator'); ?>
|
716 |
+
</div>
|
717 |
+
<?php endif;?>
|
718 |
+
</td>
|
719 |
+
</tr>
|
720 |
+
<tr<?php if(!$useAuth){echo ' style="display:none"';}?>>
|
721 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
722 |
+
<label for="<?php echo key_ga_widgets; ?>"><?php _e('Include widgets', 'google-analyticator'); ?>:</label>
|
723 |
+
</th>
|
724 |
+
<td>
|
725 |
+
<?php
|
726 |
+
echo "<select name='".key_ga_widgets."' id='".key_ga_widgets."'>\n";
|
727 |
+
|
728 |
+
echo "<option value='".ga_enabled."'";
|
729 |
+
if(get_option(key_ga_widgets) == ga_enabled)
|
730 |
+
echo " selected='selected'";
|
731 |
+
echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
|
732 |
+
|
733 |
+
echo "<option value='".ga_disabled."'";
|
734 |
+
if(get_option(key_ga_widgets) == ga_disabled)
|
735 |
+
echo" selected='selected'";
|
736 |
+
echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
|
737 |
+
|
738 |
+
echo "</select>\n";
|
739 |
+
?>
|
740 |
+
<p class="setting-description"><?php _e('Disabling this option will completely remove the Dashboard Summary widget and the theme Stats widget. Use this option if you would prefer to not see the widgets.', 'google-analyticator'); ?></p>
|
741 |
+
</td>
|
742 |
+
</tr>
|
743 |
+
<tr<?php if(!$useAuth){echo ' style="display:none"';}?>>
|
744 |
+
<th width="30%" valign="top" style="padding-top: 10px;">
|
745 |
+
<label for="<?php echo key_ga_dashboard_role ?>"><?php _e('User roles that can see the dashboard widget', 'google-analyticator'); ?>:</label>
|
746 |
+
</th>
|
747 |
+
<td>
|
748 |
+
<?php
|
749 |
+
global $wp_roles;
|
750 |
+
$roles = $wp_roles->get_names();
|
751 |
+
$selected_roles = get_option(key_ga_dashboard_role);
|
752 |
+
if ( !is_array($selected_roles) ) $selected_roles = array();
|
753 |
+
|
754 |
+
# Loop through the roles
|
755 |
+
foreach ( $roles AS $role => $name ) {
|
756 |
+
echo '<input type="checkbox" value="' . $role . '" name="' . key_ga_dashboard_role . '[]"';
|
757 |
+
if ( in_array($role, $selected_roles) )
|
758 |
+
echo " checked='checked'";
|
759 |
+
$name_pos = strpos($name, '|');
|
760 |
+
$name = ( $name_pos ) ? substr($name, 0, $name_pos) : $name;
|
761 |
+
echo ' /> ' . _x($name, 'User role') . '<br />';
|
762 |
+
}
|
763 |
+
?>
|
764 |
+
<p class="setting-description"><?php _e('Specifies the user roles that can see the dashboard widget. If a user is not in one of these role groups, they will not see the dashboard widget.', 'google-analyticator'); ?></p>
|
765 |
+
</td>
|
766 |
+
</tr>
|
767 |
+
|
768 |
+
</table>
|
769 |
+
<p class="submit">
|
770 |
+
<input type="submit" name="info_update" value="<?php _e('Save Changes', 'google-analyticator'); ?>" />
|
771 |
+
</p>
|
772 |
+
|
773 |
+
<a href="<?php echo admin_url('/options-general.php?page=ga_reset'); ?>"><?php _e('Deauthorize & Reset Google Analyticator.', 'google-analyticator'); ?></a>
|
774 |
+
|
775 |
+
</form>
|
776 |
+
|
777 |
+
|
778 |
+
<?php if (!get_option('wpm_o_user_id')): ?>
|
779 |
+
<img src="<?php echo plugins_url('wlcms-plugin-advert.png', __FILE__ ); ?>" alt="Learn how to make WordPress better" />
|
780 |
+
<form method="post" onsubmit="return quickValidate()" action="http://www.aweber.com/scripts/addlead.pl" target="_blank" >
|
781 |
+
<div style="display: none;">
|
782 |
+
<input type="hidden" name="meta_web_form_id" value="672327302" />
|
783 |
+
<input type="hidden" name="meta_split_id" value="" />
|
784 |
+
<input type="hidden" name="listname" value="vumpublic2" />
|
785 |
+
<input type="hidden" name="redirect" value="http://www.aweber.com/thankyou-coi.htm?m=video" id="redirect_9567c93ed4b6fb0c7cd9247553c362eb" />
|
786 |
+
<input type="hidden" name="meta_adtracking" value="ga-plugin" />
|
787 |
+
<input type="hidden" name="meta_message" value="1" />
|
788 |
+
<input type="hidden" name="meta_required" value="name,email" />
|
789 |
+
<input type="hidden" name="meta_tooltip" value="" />
|
790 |
+
</div>
|
791 |
+
<table style="text-align:center;margin-left: 20px;">
|
792 |
+
<tr>
|
793 |
+
<td><label class="previewLabel" for="awf_field-37978044"><strong>Name: </strong></label><input id="sub_name" type="text" name="name" class="text" tabindex="500" value="" /></td>
|
794 |
+
<td><label class="previewLabel" for="awf_field-37978045"><strong>Email: </strong></label> <input class="text" id="sub_email" type="text" name="email" tabindex="501" value="" /></td>
|
795 |
+
<td><span class="submit"><input name="submit" type="image" alt="submit" tabindex="502" src="<?php echo plugins_url('download-button.png', __FILE__); ?>" width="157" height="40" style="background: none; border: 0;" /></span></td>
|
796 |
+
</tr>
|
797 |
+
<tr>
|
798 |
+
<td colspan="3" style="padding-top: 20px;">
|
799 |
+
<a title="Privacy Policy" href="http://www.aweber.com/permission.htm" target="_blank"><img src="<?php echo plugins_url('privacy.png', __FILE__); ?>" alt="" title="" /></a>
|
800 |
+
</td>
|
801 |
+
</tr>
|
802 |
+
</table>
|
803 |
+
</form>
|
804 |
+
<?php endif;?>
|
805 |
+
|
806 |
+
<script type="text/javascript">
|
807 |
+
function quickValidate()
|
808 |
+
{
|
809 |
+
if (! jQuery('#sub_name').val() )
|
810 |
+
{
|
811 |
+
alert('Your Name is required');
|
812 |
+
return false;
|
813 |
+
}
|
814 |
+
if(! jQuery('#sub_email').val() )
|
815 |
+
{
|
816 |
+
alert('Your Email is required');
|
817 |
+
return false;
|
818 |
+
}
|
819 |
+
|
820 |
+
return true;
|
821 |
+
|
822 |
+
}
|
823 |
+
</script>
|
824 |
+
|
825 |
+
</div>
|
826 |
+
</form>
|
827 |
+
|
828 |
+
<?php
|
829 |
+
}
|
830 |
+
|
831 |
+
function ga_sort_account_list($a, $b) {
|
832 |
+
return strcmp($a['title'],$b['title']);
|
833 |
+
}
|
834 |
+
|
835 |
+
/**
|
836 |
+
* Checks if the WordPress API is a valid method for selecting an account
|
837 |
+
*
|
838 |
+
* @return a list of accounts if available, false if none available
|
839 |
+
**/
|
840 |
+
function ga_get_analytics_accounts()
|
841 |
+
{
|
842 |
+
$accounts = array();
|
843 |
+
|
844 |
+
# Get the class for interacting with the Google Analytics
|
845 |
+
require_once('class.analytics.stats.php');
|
846 |
+
|
847 |
+
# Create a new Gdata call
|
848 |
+
if ( isset($_POST['token']) && $_POST['token'] != '' )
|
849 |
+
$stats = new GoogleAnalyticsStats($_POST['token']);
|
850 |
+
elseif ( trim(get_option('ga_google_token')) != '' )
|
851 |
+
$stats = new GoogleAnalyticsStats();
|
852 |
+
else
|
853 |
+
return false;
|
854 |
+
|
855 |
+
# Check if Google sucessfully logged in
|
856 |
+
if ( ! $stats->checkLogin() )
|
857 |
+
return false;
|
858 |
+
|
859 |
+
# Get a list of accounts
|
860 |
+
$accounts = $stats->getAllProfiles();
|
861 |
+
|
862 |
+
natcasesort ($accounts);
|
863 |
+
|
864 |
+
# Return the account array if there are accounts
|
865 |
+
if ( count($accounts) > 0 )
|
866 |
+
return $accounts;
|
867 |
+
else
|
868 |
+
return false;
|
869 |
+
}
|
870 |
+
|
871 |
+
/**
|
872 |
+
* Add http_build_query if it doesn't exist already
|
873 |
+
**/
|
874 |
+
if ( !function_exists('http_build_query') ) {
|
875 |
+
function http_build_query($params, $key = null)
|
876 |
+
{
|
877 |
+
$ret = array();
|
878 |
+
|
879 |
+
foreach( (array) $params as $name => $val ) {
|
880 |
+
$name = urlencode($name);
|
881 |
+
|
882 |
+
if ( $key !== null )
|
883 |
+
$name = $key . "[" . $name . "]";
|
884 |
+
|
885 |
+
if ( is_array($val) || is_object($val) )
|
886 |
+
$ret[] = http_build_query($val, $name);
|
887 |
+
elseif ($val !== null)
|
888 |
+
$ret[] = $name . "=" . urlencode($val);
|
889 |
+
}
|
890 |
+
|
891 |
+
return implode("&", $ret);
|
892 |
+
}
|
893 |
+
}
|
894 |
+
|
895 |
+
/**
|
896 |
+
* Echos out the core Analytics tracking code
|
897 |
+
**/
|
898 |
+
function add_google_analytics()
|
899 |
+
{
|
900 |
+
# Fetch variables used in the tracking code
|
901 |
+
$uid = stripslashes(get_option(key_ga_uid));
|
902 |
+
$extra = stripslashes(get_option(key_ga_extra));
|
903 |
+
$extra_after = stripslashes(get_option(key_ga_extra_after));
|
904 |
+
$extensions = str_replace (",", "|", get_option(key_ga_downloads));
|
905 |
+
|
906 |
+
# Determine if the GA is enabled and contains a valid UID
|
907 |
+
if ( ( get_option(key_ga_status) != ga_disabled ) && ( $uid != "XX-XXXXX-X" ) )
|
908 |
+
{
|
909 |
+
# Determine if the user is an admin, and should see the tracking code
|
910 |
+
if ( ( get_option(key_ga_admin) == ga_enabled || !ga_current_user_is(get_option(key_ga_admin_role)) ) && get_option(key_ga_admin_disable) == 'remove' || get_option(key_ga_admin_disable) != 'remove' )
|
911 |
+
{
|
912 |
+
# Disable the tracking code on the post preview page
|
913 |
+
if ( !function_exists("is_preview") || ( function_exists("is_preview") && !is_preview() ) )
|
914 |
+
{
|
915 |
+
# Add the notice that Google Analyticator tracking is enabled
|
916 |
+
echo "<!-- Google Analytics Tracking by Google Analyticator " . GOOGLE_ANALYTICATOR_VERSION . ": http://www.videousermanuals.com/google-analyticator/ -->\n";
|
917 |
+
|
918 |
+
# Add the Adsense data if specified
|
919 |
+
if ( get_option(key_ga_adsense) != '' )
|
920 |
+
echo '<script type="text/javascript">window.google_analytics_uacct = "' . get_option(key_ga_adsense) . "\";</script>\n";
|
921 |
+
|
922 |
+
# Include the file types to track
|
923 |
+
$extensions = explode(',', stripslashes(get_option(key_ga_downloads)));
|
924 |
+
$ext = "";
|
925 |
+
foreach ( $extensions AS $extension )
|
926 |
+
$ext .= "'$extension',";
|
927 |
+
$ext = substr($ext, 0, -1);
|
928 |
+
|
929 |
+
# Include the link tracking prefixes
|
930 |
+
$outbound_prefix = stripslashes(get_option(key_ga_outbound_prefix));
|
931 |
+
$downloads_prefix = stripslashes(get_option(key_ga_downloads_prefix));
|
932 |
+
$event_tracking = get_option(key_ga_event);
|
933 |
+
|
934 |
+
?>
|
935 |
+
<script type="text/javascript">
|
936 |
+
var analyticsFileTypes = [<?php echo strtolower($ext); ?>];
|
937 |
+
<?php if ( $event_tracking != 'enabled' ) { ?>
|
938 |
+
var analyticsOutboundPrefix = '/<?php echo $outbound_prefix; ?>/';
|
939 |
+
var analyticsDownloadsPrefix = '/<?php echo $downloads_prefix; ?>/';
|
940 |
+
<?php } ?>
|
941 |
+
var analyticsEventTracking = '<?php echo $event_tracking; ?>';
|
942 |
+
</script>
|
943 |
+
<?php
|
944 |
+
# Add the first part of the core tracking code
|
945 |
+
?>
|
946 |
+
<script type="text/javascript">
|
947 |
+
var _gaq = _gaq || [];
|
948 |
+
_gaq.push(['_setAccount', '<?php echo $uid; ?>']);
|
949 |
+
_gaq.push(['_addDevId', 'i9k95']); // Google Analyticator App ID with Google
|
950 |
+
<?php
|
951 |
+
|
952 |
+
# Add any tracking code before the trackPageview
|
953 |
+
do_action('google_analyticator_extra_js_before');
|
954 |
+
if ( '' != $extra )
|
955 |
+
echo " $extra\n";
|
956 |
+
|
957 |
+
# Add the track pageview function
|
958 |
+
echo " _gaq.push(['_trackPageview']);\n";
|
959 |
+
|
960 |
+
# Add the site speed tracking
|
961 |
+
if ( get_option(key_ga_sitespeed) == ga_enabled )
|
962 |
+
echo " _gaq.push(['_trackPageLoadTime']);\n";
|
963 |
+
|
964 |
+
# Disable page tracking if admin is logged in
|
965 |
+
if ( ( get_option(key_ga_admin) == ga_disabled ) && ( ga_current_user_is(get_option(key_ga_admin_role)) ) )
|
966 |
+
echo " _gaq.push(['_setCustomVar', 'admin']);\n";
|
967 |
+
|
968 |
+
# Add any tracking code after the trackPageview
|
969 |
+
do_action('google_analyticator_extra_js_after');
|
970 |
+
if ( '' != $extra_after )
|
971 |
+
echo " $extra_after\n";
|
972 |
+
|
973 |
+
# Add the final section of the tracking code
|
974 |
+
?>
|
975 |
+
|
976 |
+
(function() {
|
977 |
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
978 |
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
979 |
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
980 |
+
})();
|
981 |
+
</script>
|
982 |