Skip to content

Commit

Permalink
adding wordpress.org assets, updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Sep 17, 2021
1 parent 6ee2971 commit fb90b31
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 28 deletions.
Binary file added .wordpress-org/banner-1544x500.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-722-250.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-128x128.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/icon-256x256.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ The official plugin for integrating Open Web Analytics with WordPress based web

## Features


- Track all public web pages
- Track WordPress admin interface pages
- Track internal WordPress actions (New Post, Page Edit, comment, etc.)
Expand Down
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== Open Web Analytics for WordPress ===
=== Open Web Analytics for WordPress ===

Contributors: padams
Donate link: http://paypal.me/openwebanalytics
Expand All @@ -13,7 +13,7 @@ The official plugin for integrating Open Web Analytics with WordPress based web

== Description ==

Open Web Analytics is an open source alternative to commercial tools such as Google Analytics. Stay in control of the data you collect about the use of your website or app. This plugin does NOT install an instance of OWA server. It requires that you have admin access to a running instance of OWA.
Open Web Analytics is an open source alternative to commercial tools such as Google Analytics. Stay in control of the data you collect about the users of your website or app. This plugin does NOT install an instance of OWA server. It requires that you have admin access to a running instance of OWA.

= FEATURES =

Expand Down
86 changes: 61 additions & 25 deletions owa-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class owa_wp_plugin extends module {
// SDK singleton
var $owaSdk = '';

var $adminMsgs = [];

/**
* Constructor
*
Expand Down Expand Up @@ -162,18 +164,27 @@ function _init() {
add_action('wpmu_new_blog', array($this, 'createTrackedSiteForNewBlog'), 10, 6);

// remove this if uneeded
if ( false ) {
if ( ! $this->isOwaReadyToTrack() ) {

add_action('admin_notices', array($this, 'showNag') );
}
$this->adminMsgs[] = ['Open Web Analytics requires a valid <b>API Key</b>, <b>Endpoint</b>, and <b>Site ID</b> before tracking can begin.', 'notice-warning'];

}

add_action('admin_notices', array( $this, 'showNag') );

}

}

function showNag() {
function showNag( $msg ) {

echo '<BR><div class="update-nag "><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>';
if ( $this->adminMsgs ) {

foreach ( $this->adminMsgs as $msg ) {

_e( sprintf( '<BR><div class="notice %s"><p>%s</p></div>', esc_attr( $msg[1] ), $msg[0] ) );
}
}
}


Expand Down Expand Up @@ -387,6 +398,21 @@ function cmdsToString() {
return $out;
}

function isOwaReadyToTrack() {


if ( $this->getOption( 'owaEndpoint' ) && $this->getOption( 'apiKey' ) && $this->getOption('siteId') ) {

return true;
}

}

function makeOwaInstanceValidationHash() {


}

// init the OWA SDK
function initOwaSdk() {

Expand Down Expand Up @@ -763,27 +789,24 @@ function trackCommentEditAction( $new_status, $old_status, $comment ) {
}

// Tracks feed requests
// @todo this needs reworking

function trackFeedRequest() {

if ( is_feed() ) {

$owa = $this->getOwaTrackerInstance();

if( $owa->getSetting( 'base', 'log_feedreaders') ) {
if ( is_feed() && $this->getOption( 'trackFeeds') ) {

self::debug('Tracking WordPress feed request');
self::debug('Tracking WordPress feed request');

$owa = $this->getOwaTrackerInstance();

$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 );
}
$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 );
}
}

Expand Down Expand Up @@ -843,7 +866,7 @@ public function registerOptions() {
'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)',
'description' => 'Select the ID of the website you want to track. New tracked websites can be added via the OWA admin interface.',
'label_for' => 'Tracked website ID',
'length' => 90,
'error_message' => '',
Expand Down Expand Up @@ -882,7 +905,7 @@ public function registerOptions() {

'trackFeeds' => array(

'default_value' => true,
'default_value' => false,
'field' => array(
'type' => 'boolean',
'title' => 'Track Feed Requests',
Expand Down Expand Up @@ -1080,7 +1103,20 @@ function pageController( $params = array() ) {
$url = $this->getOption('owaEndpoint');

// insert link to OWA endpoint
echo sprintf('<div><a href="%s">View OWA Dashboard</a>', $url);

if ( ! current_user_can( 'manage_options' ) ) {

wp_die(__( 'You do not have sufficient permissions to access this page!' ) );
}

echo '<div class="wrap">';
echo '<div class="icon32" id="icon-options-general"><br></div>';
echo sprintf('<h2>%s</h2>', 'Analytics' );
echo 'Click the link below to view analytics in your OWA instance.';

echo sprintf('<div style="margin-top: 50px;"><a href="%s" target="_new">Launch your OWA Dashboard</a>', $url);

echo '</div>';
}

/**
Expand Down

0 comments on commit fb90b31

Please sign in to comment.