forked from Open-Web-Analytics/Open-Web-Analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp_plugin.php
2631 lines (1859 loc) · 61.2 KB
/
wp_plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
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
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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
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
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
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
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
<?php
/*
Plugin Name: Open Web Analytics
Plugin URI: http://www.openwebanalytics.com
Description: This plugin enables Wordpress blog owners to use the Open Web Analytics Framework.
Author: Peter Adams
Version: master
Author URI: http://www.openwebanalytics.com
*/
//
// THIS PLUGIN IS NOW DEPRECATED.
// See: https://github.com/Open-Web-Analytics/owa-wordpress-plugin/wiki/Migrating-from-the-Old-Bundled-Plugin
//
// if this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Define the plugin path constant
define('OWA_WP_PATH', plugin_dir_path( __FILE__ ) );
// Hook package creation
add_action('plugins_loaded', array( 'owa_wp_plugin', 'getInstance'), 10 );
// Installation hook
//register_activation_hook(__FILE__, array('owa_wp_plugin', 'install') );
/////////////////////////////////////////////////////////////////////////////////
/**
* OWA WordPress Plugin Class
*
*/
class owa_wp_plugin extends owa_wp_module {
// cmd array
var $cmds = array();
// plugin options
var $options = array(
'track_feed_links' => true,
'feed_tracking_medium' => 'feed',
'feed_subscription_param' => 'owa_sid'
);
/**
* Constructor
*
*/
function __construct() {
// needed???
ob_start();
// bail if this isn't a request type that OWA needs ot be loaded on.
if ( ! $this->isProperWordPressRequest() ) {
return;
}
// load parent constructor
$params = array();
$params['module_name'] = 'owa-wordpress';
parent::__construct( $params );
}
/**
* Singelton
*/
static function getInstance() {
static $o;
if ( ! isset( $o ) ) {
$o = new owa_wp_plugin();
}
return $o;
}
function _init() {
add_action('admin_notices', array($this, 'migrateNag') );
// setup plugin options
$this->initOptions();
// register WordPress hooks and filters
if ( $this->getOption('enable') ) {
// insert javascript tracking tag
add_action('wp_head', array( $this,'insertTrackingTag' ), 100 );
if ( $this->getOption('trackAdminPages') ) {
add_action('admin_head', array( $this,'insertTrackingTag' ), 100 );
}
// track feeds
if ( $this->getOption('trackFeeds') ) {
// add tracking to feed entry permalinks
add_filter('the_permalink_rss', array( $this, 'decorateFeedEntryPermalink' ) );
// add tracking to feed subscription links
add_filter('bloginfo_url', array($this, 'decorateFeedSubscriptionLink' ) );
}
// Track admin actions if OWA is available as a library
if( $this->isOwaAvailable() ) {
// @todo find a way for these methods to POST these to the OWA instance instead of via OWA's PHP Tracker
$this->defineActionHooks();
// Create a new tracked site in OWA.
// @todo move this to REST API call when it's ready.
add_action('wpmu_new_blog', array($this, 'createTrackedSiteForNewBlog'), 10, 6);
$owa = self::getOwaInstance();
if ( owa_coreAPI::isUpdateRequired() ) {
add_action('admin_notices', array($this, 'updateNag') );
}
}
}
}
function updateNag() {
echo '<BR><div class="notice notice-error "><p>'. '<b>Open Web Analytics</b> updates are required before tracking can continue. <a href="/wp-admin/admin.php?page=owa-analytics">Please update now!</a></p></div>';
}
function migrateNag() {
$url = network_admin_url( 'plugin-install.php?s=padams&tab=search&type=author' );
$template = '<BR><div class="notice notice-error "><p><b>This version of the Open Web Analytics plugin is now deprecated!</b> Please install the <a href="%s">new official OWA Integration Plugin</a> from the WordPress repository before upgrading OWA any further. <a href="https://github.com/Open-Web-Analytics/owa-wordpress-plugin/wiki/Migrating-from-the-Old-Bundled-Plugin">Learn more here!</a></p></div>';
echo sprintf($template, $url);
}
private function isProperWordPressRequest() {
// cron requests
if ( array_key_exists('doing_wp_cron', $_GET ) ) {
return;
}
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
return;
}
if ( defined( 'JSON_REQUEST' ) && JSON_REQUEST ) {
return;
}
return true;
}
private function initOptions() {
// needs to be first as default Options are set here and used down stream in
// all other hooks and classes.
$this->processAdminConfig();
// get user defaults from option page
$user_defaults = array_combine( array_keys( $this->registerOptions() ), array_column( $this->registerOptions() , 'default_value') );
if ( $user_defaults ) {
$this->options = array_merge($this->options, $user_defaults);
}
// fetch plugin options from DB and combine them with defaults.
$options = get_option( 'owa_wp' );
//echo 'options from DB: '. print_r( $options, true );
if ( $options ) {
$this->options = array_merge($this->options, $options);
}
// needed for backwards compatability of old style embedded installs.
// must go after user default merge
$this->setEmbeddedOptions();
}
/**
* Get an option value
*/
function getOption( $key ) {
$options = array();
$options = $this->options;
if ( array_key_exists( $key, $options ) ) {
return $this->options[ $key ];
}
}
/**
* Set an option value
*/
function setOption( $key, $value ) {
$this->options[ $key ] = $value;
}
/**
* Hooks for tracking WordPress Admin actions
*/
function defineActionHooks() {
// These hooks rely on accessing OWA server-side
// as a PHP object.
if ( $this->getOption( 'trackAdminActions' ) ) {
// New Comment
add_action( 'comment_post', array( $this, 'trackCommentAction' ), 10, 2);
// Comment Edit
add_action( 'transition_comment_status', array( $this, 'trackCommentEditAction' ), 10, 3);
// User Registration
add_action( 'user_register', array( $this, 'trackUserRegistrationAction' ) );
// user login
add_action( 'wp_login', array( $this, 'trackUserLoginAction' ) );
// User Profile Update
add_action( 'profile_update', array( $this, 'trackUserProfileUpdateAction' ), 10, 2);
// Password Reset
add_action( 'password_reset', array( $this, 'trackPasswordResetAction' ) );
// Trackback
add_action( 'trackback_post', array( $this, 'trackTrackbackAction' ) );
// New Attachment
add_action( 'add_attachment', array( $this, 'trackAttachmentCreatedAction' ) );
// Attachment Edit
add_action( 'edit_attachment', array( $this, 'trackAttachmentEditAction' ) );
// Post Edit
add_action( 'transition_post_status', array( $this, 'trackPostAction') , 10, 3);
// New Blog (WPMU)
add_action( 'wpmu_new_blog', array( $this, 'trackNewBlogAction') , 10, 5);
}
// track feeds
if ( $this->getOption( 'trackFeeds' ) ) {
add_action('wp_loaded', array( $this, 'addFeedTrackingQueryParams'));
add_action( 'template_redirect', array( $this, 'trackFeedRequest'), 1 );
}
}
// Add query vars to WordPress
function addFeedTrackingQueryParams() {
global $wp;
// feed tracking param
$wp->add_query_var('owa_sid');
}
/**
* Determines the title of the page being requested
*
* @param string $page_type
* @return string $title
*/
function getPageTitle() {
$page_type = $this->getPageType();
if ( $page_type == "Home" ) {
$title = get_bloginfo( "name" );
} elseif ( $page_type == "Search Results" ) {
$title = "Search Results for \"" . get_search_query() . "\"";
} else {
$title = wp_title($sep = '', $display = 0);
}
return $title;
}
function setPageTitleCmd() {
$this->cmds[] = sprintf("owa_cmds.push([ 'setPageTitle', '%s' ]);", $this->getPageTitle() );
}
function setUserNameCmd() {
$current_user = wp_get_current_user();
$this->cmds[] = sprintf("owa_cmds.push([ 'setUserName', '%s' ]);", $current_user->user_login );
}
/**
* Determines the type of WordPress page
*
* @return string $type
*/
function getPageType() {
if ( is_home() ) {
$type = "Home";
} elseif ( is_attachment() ){
$type = "Attachment";
} elseif ( is_page() ) {
$type = "Page";
// general page catch, should be after more specific post types
} elseif ( is_single() ) {
$type = "Post";
} elseif ( is_feed() ) {
$type = "Feed";
} elseif ( is_author() ) {
$type = "Author";
} elseif ( is_category() ) {
$type = "Category";
} elseif ( is_search() ) {
$type = "Search Results";
} elseif ( is_month() ) {
$type = "Month";
} elseif ( is_day() ) {
$type = "Day";
} elseif ( is_year() ) {
$type = "Year";
} elseif ( is_time() ) {
$type = "Time";
} elseif ( is_tag() ) {
$type = "Tag";
} elseif ( is_tax() ) {
$type = "Taxonomy";
// general archive catch, should be after specific archive types
} elseif ( is_archive() ) {
$type = "Archive";
} elseif ( is_admin() ) {
$type = "Admin";
} else {
$type = '(not set)';
}
return $type;
}
function setDebugCmd() {
$this->cmds[] = "owa_cmds.push( ['setDebug', true ] );";
}
function setSiteIdCmd() {
$this->cmds[] = sprintf("owa_cmds.push( ['setSiteId', '%s' ] );", $this->getOption('siteId') );
}
function setPageTypeCmd() {
$this->cmds[] = sprintf("owa_cmds.push( ['setPageType', '%s' ] );", $this->getPageType() );
}
function setTrackPageViewCmd() {
$this->cmds[] = "owa_cmds.push( ['trackPageView'] );";
}
function setTrackClicksCmd() {
$this->cmds[] = "owa_cmds.push( ['trackClicks'] );";
}
function setTrackDomstreamsCmd() {
$this->cmds[] = "owa_cmds.push( ['trackDomStream'] );";
}
function cmdsToString() {
$out = '';
foreach ( $this->cmds as $cmd ) {
$out .= $cmd . " \n";
}
return $out;
}
// check to see if OWA is available as a php library on the same server
function isOwaAvailable() {
if ( $this->getOption( 'owaPath' ) ) {
$owa = owa_wp_plugin::getOwaInstance();
return $owa->isOwaInstalled();
}
}
/**
* Insert Tracking Tag
*
* Adds javascript tracking tag int <head> of all pages.
*
*/
function insertTrackingTag() {
if (is_admin()) {
$screen = get_current_screen();
///print_r($screen);
if ( in_array( $screen->id, [ 'owa_page_owa-analytics', 'owa_page_owa-wordpress' ] ) ) {
return;
}
}
// Don't log if the page request is a preview - Wordpress 2.x or greater
if ( function_exists( 'is_preview' ) ) {
if ( is_preview() ) {
return;
}
}
// dont log customizer previews either.
if ( function_exists( 'is_customize_preview' ) ) {
if ( is_customize_preview() ) {
return;
}
}
// dont log requests for admin interface pages
if ( ! $this->getOption( 'trackAdminPages') && function_exists( ' is_admin' ) && is_admin() ) {
return;
}
// set user name in tracking for names users with wp-admin accounts
if ( $this->getOption( 'trackNamedUsers') ) {
$this->setUserNameCmd();
}
// get instance of OWA
$owa = self::getOwaInstance();
// set any cmds
if ( $this->getOption('debug') ) {
$this->setDebugCmd();
}
$this->setSiteIdCmd();
$this->setPageTypeCmd();
$this->setPageTitleCmd();
// set track clicks command
if ( $this->getOption('trackClicks') ) {
$this->setTrackClicksCmd();
}
// set track domstream command
if ( $this->getOption('trackDomstreams') ) {
$this->setTrackDomstreamsCmd();
}
// set track page view command
$this->setTrackPageViewCmd();
// convert cmds to string and pass to tracking tag template
$options = $this->cmdsToString();
echo sprintf( $this->getTrackerSnippetTemplate(), $options );
}
function getTrackerSnippetTemplate() {
$tag = "<!-- Open Web Analytics --> \n";
$tag .= '<script type="text/javascript">' . "\n";
$tag .= "var owa_cmds = owa_cmds || []; \n";
$base_url = $this->getOption('owaEndpoint');
$tag .= "var owa_baseUrl = '$base_url'; \n";
$tag .= "%s";
$tag .= "
(function() {var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);}());
\n ";
$tag .= "</script> \n
<!-- End Open Web Analytics --> \n
";
return $tag;
}
/**
* Adds tracking source param to links in feeds
*
* @param string $link
* @return string
*/
function decorateFeedEntryPermalink($link) {
// check for presence of '?' which is not present under URL rewrite conditions
if ( $this->getOption( 'track_feed_links' ) ) {
if ( strpos($link, "?") === false ) {
// add the '?' if not found
$link .= '?';
}
// setup link template
$link_template = "%s&%s=%s&%s=%s";
return sprintf($link_template,
$link,
'owa_medium',
$this->getOption( 'feed_tracking_medium' ),
$this->getOption( 'feed_subscription_param' ),
$_GET[ $this->getOption( 'feed_subscription_param' ) ]
);
}
}
/**
* Wordpress filter function adds a GUID to the feed URL.
*
* @param array $binfo
* @return string $newbinfo
*/
function decorateFeedSubscriptionLink( $binfo ) {
$is_feed = strpos($binfo, "feed=");
if ( $is_feed && $this->getOption( 'track_feed_links' ) ) {
$guid = crc32(getmypid().microtime());
$newbinfo = $binfo . "&" . $this->getOption('feed_subscription_param') . "=" . $guid;
} else {
$newbinfo = $binfo;
}
return $newbinfo;
}
// create a new tracked site.
function createTrackedSiteForNewBlog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
$owa = self::getOwaInstance();
$sm = owa_coreAPI::supportClassFactory( 'base', 'siteManager' );
$sm->createNewSite( $domain, $domain, '', '');
}
/**
* New Blog Action Tracker
*/
function trackNewBlogAction( $blog_id, $user_id, $domain, $path, $site_id ) {
$owa = self::getOwaInstance();
$owa->trackAction('WordPress', 'Blog Created', $domain);
}
/**
* Edit Post Action Tracker
*/
function trackedPostEditAction( $post_id, $post ) {
// we don't want to track autosaves...
if( wp_is_post_autosave( $post ) ) {
return;
}
$owa = self::getOwaInstance();
$label = $post->post_title;
$owa->trackAction( 'WordPress', $post->post_type.' edited', $label );
}
/**
* Post Action Tracker
*
* Trackes new and edited post actions. Including custom post types.
*/
function trackPostAction( $new_status, $old_status, $post ) {
$action_name = '';
// we don't want to track autosaves...
if(wp_is_post_autosave( $post ) ) {
return;
}
// or drafts
if ( $new_status === 'draft' && $old_status === 'draft' ) {
return;
}
// set action label
if ( $new_status === 'publish' && $old_status != 'publish' ) {
$action_name = $post->post_type.' publish';
} elseif ( $new_status === $old_status ) {
$action_name = $post->post_type.' edit';
}
// track action
if ( $action_name ) {
$owa = self::getOwaInstance();
owa_coreAPI::debug(sprintf("new: %s, old: %s, post: %s", $new_status, $old_status, print_r($post, true)));
$label = $post->post_title;
$owa->trackAction('WordPress', $action_name, $label);
}
}
/**
* Edit Attachment Action Tracker
*/
function trackAttachmentEditAction( $post_id ) {
$owa = self::getOwaInstance();
$post = get_post( $post_id );
$label = $post->post_title;
$owa->trackAction('WordPress', 'Attachment Edit', $label);
}
/**
* New Attachment Action Tracker
*/
function trackAttachmentCreatedAction( $post_id ) {
$owa = self::getOwaInstance();
$post = get_post($post_id);
$label = $post->post_title;
$owa->trackAction('WordPress', 'Attachment Created', $label);
}
/**
* User Registration Action Tracker
*/
function trackUserRegistrationAction( $user_id ) {
$owa = self::getOwaInstance();
$user = get_userdata($user_id);
if (!empty($user->first_name) && !empty($user->last_name)) {
$label = $user->first_name.' '.$user->last_name;
} else {
$label = $user->display_name;
}
$owa->trackAction('WordPress', 'User Registration', $label);
}
/**
* User Login Action Tracker
*/
function trackUserLoginAction( $user_id ) {
$owa = self::getOwaInstance();
$label = $user_id;
$owa->trackAction('WordPress', 'User Login', $label);
}
/**
* Profile Update Action Tracker
*/
function trackUserProfileUpdateAction( $user_id, $old_user_data = '' ) {
$owa = self::getOwaInstance();
$user = get_userdata($user_id);
if (!empty($user->first_name) && !empty($user->last_name)) {
$label = $user->first_name.' '.$user->last_name;
} else {
$label = $user->display_name;
}
$owa->trackAction('WordPress', 'User Profile Update', $label);
}
/**
* Password Reset Action Tracker
*/
function trackPasswordResetAction( $user ) {
$owa = self::getOwaInstance();
$label = $user->display_name;
$owa->trackAction('WordPress', 'User Password Reset', $label);
}
/**
* Trackback Action Tracker
*/
function trackTrackbackAction( $comment_id ) {
$owa = self::getOwaInstance();
$label = $comment_id;
$owa->trackAction('WordPress', 'Trackback', $label);
}
function trackCommentAction( $id, $comment_data = '' ) {
if ( $comment_data === 'approved' || $comment_data === 1 ) {
$owa = self::getOwaInstance();
$label = '';
$owa->trackAction('WordPress', 'comment', $label);
}
}
function trackCommentEditAction( $new_status, $old_status, $comment ) {
if ($new_status === 'approved') {
if (isset($comment->comment_author)) {
$label = $comment->comment_author;
} else {
$label = '';
}
$owa = self::getOwaInstance();
$owa->trackAction('WordPress', 'comment', $label);
}
}
// Tracks feed requests
function trackFeedRequest() {
if ( is_feed() ) {
$owa = self::getOwaInstance();
if( $owa->getSetting( 'base', 'log_feedreaders') ) {
owa_coreAPI::debug('Tracking WordPress feed request');
$event = $owa->makeEvent();
// set event type
$event->setEventType( 'base.feed_request' );
// determine and set the type of feed
$event->set( 'feed_format', get_query_var( 'feed' ) );
$event->set( 'feed_subscription_id', get_query_var( 'owa_sid' ) );
//$event->set( 'feed_subscription_id', $_GET['owa_sid'] );
// track
$owa->trackEvent( $event );
}
}
}
// backward compatability for old style embedded installs.
private function setEmbeddedOptions() {
// check for presence of OWA in same directory.
// used by isOwaAvailable method.
$path = plugin_dir_path(__FILE__) ;
if ( file_exists( $path.'owa_env.php' ) ) {
$this->setOption('owaPath', $path );
}
if ( $this->isOwaAvailable() ) {
$this->setOption('trackAdminActions', true);
$owa = self::getOwaInstance();
if ( ! $this->getOption('apiKey') ) {
$cu = owa_coreAPI::getCurrentUser();
$this->setOption('apiKey', $cu->getUserData('api_key') );
}
$this->setOption('owaEndpoint', $owa->getSetting('base', 'public_url') );
// set site iD, if not already set from the DB
if ( ! $this->getOption('siteId') ) {
$this->setOption('siteId', self::generateSiteId() );
}
}
owa_wp_util::addFilter('owa_wp_settings_field_siteId', array( $this, 'getSitesFromOwa'), 10, 1);
}
public function registerOptions() {
$settings = array(
'enable' => array(
'default_value' => true,
'field' => array(
'type' => 'boolean',
'title' => 'Enable OWA ',
'page_name' => 'owa-wordpress',
'section' => 'general',
'description' => 'Enable OWA.',
'label_for' => 'Enable OWA.',
'error_message' => 'You must select On or Off.'
)
),
'apiKey' => array(
'default_value' => '',
'field' => array(
'type' => 'text',
'title' => 'API Key',
'page_name' => 'owa-wordpress',
'section' => 'general',
'description' => 'API key for accessing your OWA instance.',
'label_for' => 'OWA API Key',
'length' => 70,
'error_message' => ''
)
),
'owaEndpoint' => array(
'default_value' => '',
'field' => array(
'type' => 'url',
'title' => 'OWA Endpoint',
'page_name' => 'owa-wordpress',
'section' => 'general',
'description' => 'The URL of your OWA instance. (i.e. http://www.mydomain.com/path/to/owa/)',
'label_for' => 'OWA Endpoint',
'length' => 70,
'error_message' => ''
)
),
'siteId' => array(
'default_value' => '',
'field' => array(
'type' => 'select',
'title' => 'Website ID',
'page_name' => 'owa-wordpress',
'section' => 'general',
'description' => 'Select the ID of the website you want to track. (must have a valid API key and endpoint)',
'label_for' => 'Tracked website ID',
'length' => 90,
'error_message' => '',
'options' => []
)
),
'trackClicks' => array(
'default_value' => true,
'field' => array(
'type' => 'boolean',
'title' => 'Track Clicks',
'page_name' => 'owa-wordpress',
'section' => 'tracking',
'description' => 'Track the clicks visitors make on your web pages.',
'label_for' => 'Track clicks within a web page',
'error_message' => 'You must select On or Off.'
)
),
'trackDomstreams' => array(
'default_value' => false,
'field' => array(
'type' => 'boolean',
'title' => 'Track Domstreams',
'page_name' => 'owa-wordpress',
'section' => 'tracking',
'description' => 'Record visitor mouse movements on each web page.',
'label_for' => 'Record mouse movements',
'error_message' => 'You must select On or Off.'
)
),
'trackFeeds' => array(
'default_value' => true,
'field' => array(
'type' => 'boolean',
'title' => 'Track Feed Requests',
'page_name' => 'owa-wordpress',
'section' => 'tracking',
'description' => 'Track requests for RSS/ATOM syndication feeds.',
'label_for' => 'Track RSSS/ATOM Feeds',
'error_message' => 'You must select On or Off.'
)
),
'trackNamedUsers' => array(
'default_value' => true,
'field' => array(
'type' => 'boolean',
'title' => 'Track Named Users',
'page_name' => 'owa-wordpress',
'section' => 'tracking',
'description' => 'Track user names and email addresses of WordPress admin users.',
'label_for' => 'Track named users',
'error_message' => 'You must select On or Off.'
)
),
'trackAdminPages' => array(
'default_value' => false,
'field' => array(
'type' => 'boolean',
'title' => 'Track WP Admin Pages',
'page_name' => 'owa-wordpress',
'section' => 'tracking',
'description' => 'Track WordPress admin interface pages (/wp-admin...)',
'label_for' => 'Track WP admin pages',
'error_message' => 'You must select On or Off.'
)
),
'trackAdminActions' => array(
'default_value' => false,
'field' => array(
'type' => 'boolean',
'title' => 'Track WP Admin Actions',
'page_name' => 'owa-wordpress',
'section' => 'tracking',
'description' => 'Track WordPress admin actions such as login, new posts, edits, etc.',
'label_for' => 'Track WP admin actions',
'error_message' => 'You must select On or Off.'
)
),
'owaPath' => array(
'default_value' => '',
'field' => array(
'type' => 'text',
'title' => 'OWA Path',
'page_name' => 'owa-wordpress',
'section' => 'advanced',