--- a/busui/owa/modules/base/module.php +++ b/busui/owa/modules/base/module.php @@ -1,1 +1,1373 @@ - +<?php + +// +// Open Web Analytics - An Open Source Web Analytics Framework +// +// Copyright 2006 Peter Adams. All rights reserved. +// +// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// $Id$ +// + +require_once(OWA_BASE_DIR.'/owa_module.php'); + +/** + * Base Package Module + * + * @author Peter Adams <peter@openwebanalytics.com> + * @copyright Copyright © 2006 Peter Adams <peter@openwebanalytics.com> + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_baseModule extends owa_module { + + /** + * Constructor + * + */ + function __construct() { + + $this->name = 'base'; + $this->display_name = 'Open Web Analytics'; + $this->group = 'Base'; + $this->author = 'Peter Adams'; + $this->version = 6; + $this->description = 'Base functionality for OWA.'; + $this->config_required = false; + $this->required_schema_version = 6; + + /** + * Register Filters + * + * The following lines register filter methods. + */ + $this->registerFilter('operating_system', $this, 'determineOperatingSystem', 0); + $this->registerFilter('ip_address', $this, 'setIp', 0); + $this->registerFilter('full_host', $this, 'resolveHost', 0); + $this->registerFilter('host', $this, 'getHostDomain', 0); + $this->registerFilter('attributed_campaign', $this, 'attributeCampaign', 10); + $this->registerFilter('geolocation', 'hostip', 'get_location', 10, 'classes'); + //Clean Query Strings + if (owa_coreAPI::getSetting('base', 'clean_query_string')) { + $this->registerFilter('page_url', $this, 'makeUrlCanonical',0); + $this->registerFilter('prior_page', $this, 'makeUrlCanonical',0); + $this->registerFilter('target_url', $this, 'makeUrlCanonical',0); + } + // event procesing daemon jobs + $this->registerBackgroundJob('process_event_queue', 'cli.php cmd=processEventQueue', owa_coreAPI::getSetting('base', 'processQueuesJobSchedule'), 10); + + /** + * Register Service Implementations + * + * The following lines register various service implementations. + */ + + /** + * Register Metrics + * + * The following lines register various data metrics. + */ + $this->registerMetric('pageViews', 'base.pageViews'); + $this->registerMetric('pageViews', 'base.pageViewsFromSessionFact'); + $this->registerMetric('uniqueVisitors', 'base.uniqueVisitors'); + $this->registerMetric('visits', 'base.visits'); + $this->registerMetric('visits', 'base.visitsFromRequestFact'); + $this->registerMetric('visitors', 'base.visitors'); + $this->registerMetric('visitors', 'base.visitorsFromRequestFact'); + $this->registerMetric('newVisitors', 'base.newVisitors'); + $this->registerMetric('repeatVisitors', 'base.repeatVisitors'); + $this->registerMetric('bounces', 'base.bounces'); + $this->registerMetric('visitDuration', 'base.visitDuration'); + $this->registerMetric('uniquePageViews', 'base.uniquePageViews'); + $this->registerMetric('bounceRate', 'base.bounceRate'); + $this->registerMetric('pagesPerVisit', 'base.pagesPerVisit'); + $this->registerMetric('actions', 'base.actions'); + $this->registerMetric('uniqueActions', 'base.uniqueActions'); + $this->registerMetric('actionsValue', 'base.actionsValue'); + //$this->registerMetric('actionsPerVisit', 'base.actionsPerVisit'); + $this->registerMetric('feedRequests', 'base.feedRequests'); + $this->registerMetric('feedReaders', 'base.feedReaders'); + $this->registerMetric('feedSubscriptions', 'base.feedSubscriptions'); + + // goals + $gcount = owa_coreAPI::getSetting('base', 'numGoals'); + for ($num = 1; $num <= $gcount;$num++) { + $params = array('goal_number' => $num); + + $metric_name = 'goal'.$num.'Completions'; + $this->registerMetric($metric_name, 'base.goalNCompletions', $params); + + $metric_name = 'goal'.$num.'Starts'; + $this->registerMetric($metric_name, 'base.goalNStarts', $params); + + $metric_name = 'goal'.$num.'Value'; + $this->registerMetric($metric_name, 'base.goalNValue', $params); + } + + $this->registerMetric('goalCompletionsAll', 'base.goalCompletionsAll'); + $this->registerMetric('goalStartsAll', 'base.goalStartsAll'); + $this->registerMetric('goalValueAll', 'base.goalValueAll'); + $this->registerMetric('goalConversionRateAll', 'base.goalConversionRateAll'); + $this->registerMetric('goalAbandonRateAll', 'base.goalAbandonRateAll'); + + // ecommerce metrics + $this->registerMetric('lineItemQuantity', 'base.lineItemQuantity'); + $this->registerMetric('lineItemQuantity', 'base.lineItemQuantityFromSessionFact'); + $this->registerMetric('lineItemRevenue', 'base.lineItemRevenue'); + $this->registerMetric('lineItemRevenue', 'base.lineItemRevenueFromSessionFact'); + $this->registerMetric('transactions', 'base.transactions'); + $this->registerMetric('transactions', 'base.transactionsFromSessionFact'); + $this->registerMetric('transactionRevenue', 'base.transactionRevenue'); + $this->registerMetric('transactionRevenue', 'base.transactionRevenueFromSessionFact'); + $this->registerMetric('taxRevenue', 'base.taxRevenue'); + $this->registerMetric('taxRevenue', 'base.taxRevenueFromSessionFact'); + $this->registerMetric('shippingRevenue', 'base.shippingRevenue'); + $this->registerMetric('shippingRevenue', 'base.shippingRevenueFromSessionFact'); + $this->registerMetric('uniqueLineItems', 'base.uniqueLineItems'); + $this->registerMetric('uniqueLineItems', 'base.uniqueLineItemsFromSessionFact'); + $this->registerMetric('revenuePerTransaction', 'base.revenuePerTransaction'); + $this->registerMetric('revenuePerVisit', 'base.revenuePerVisit'); + $this->registerMetric('ecommerceConversionRate', 'base.ecommerceConversionRate'); + $this->registerMetric('domClicks', 'base.domClicks'); + /** + * Register Dimensions + * + * The following lines register various data dimensions. + */ + $this->registerDimension('browserVersion', 'base.ua', 'browser', 'Browser Version', 'visitor', 'The browser version of the visitor.'); + $this->registerDimension('browserType', 'base.ua', 'browser_type', 'Browser Type', 'visitor', 'The browser type of the visitor.'); + $this->registerDimension('osType', 'base.os', 'name', 'Operating System', 'visitor', 'The operating System of the visitor.'); + $this->registerDimension('ipAddress', 'base.host', 'ip_address', 'IP Address', 'visitor', 'The IP address of the visitor.'); + $this->registerDimension('hostName', 'base.host', 'full_host', 'Host Name', 'visitor', 'The host name used by the visitor.'); + $this->registerDimension('city', 'base.location_dim', 'city', 'City', 'visitor', 'The city of the visitor.'); + $this->registerDimension('country', 'base.location_dim', 'country', 'Country', 'visitor', 'The country of the visitor.'); + $this->registerDimension('latitude', 'base.location_dim', 'latitude', 'Latitude', 'visitor', 'The latitude of the visitor.'); + $this->registerDimension('longitude', 'base.location_dim', 'longitude', 'Longitude', 'visitor', 'The longitude of the visitor.'); + $this->registerDimension('countryCode', 'base.location_dim', 'country_code', 'Country Code', 'visitor', 'The ISO country code of the visitor.'); + $this->registerDimension('stateRegion', 'base.location_dim', 'state', 'State/Region', 'visitor', 'The state or region of the visitor.'); + + $this->registerDimension('timeSinceLastVisit', 'base.session', 'time_sinse_priorsession', 'Time Since Last Visit', 'visitor', 'The time since the last visit.', '', true); + $this->registerDimension('isRepeatVisitor', 'base.session', 'is_repeat_visitor', 'Repeat Visitor', 'visitor', 'Repeat Site Visitor.', '', true); + $this->registerDimension('isNewVisitor', 'base.session', 'is_new_visitor', 'New Visitor', 'visitor', 'New Site Visitor.', '', true); + $this->registerDimension('language', 'base.session', 'language', 'Language', 'visit', 'The language of the visit.', '', true); + $this->registerDimension('language', 'base.request', 'language', 'Language', 'visit', 'The language of the visit.', '', true); + // campaign related + $this->registerDimension('medium', 'base.session', 'medium', 'Medium', 'visit', 'The medium of channel of visit.', '', true); + $this->registerDimension('latestAttributions', 'base.session', 'latest_attributions', 'Latest Attributions', 'visit', 'The latest campaign attributions.', '', true); + $this->registerDimension('source', 'base.source_dim', 'source_domain', 'Source', 'visit', 'The traffic source of the visit.'); + $this->registerDimension('campaign', 'base.campaign_dim', 'name', 'Campaign', 'visit', 'The campaign that originated the visit.'); + $this->registerDimension('ad', 'base.ad_dim', 'name', 'Ad', 'visit', 'The name of the ad that originated the visit.'); + $this->registerDimension('adType', 'base.ad_dim', 'type', 'Ad Type', 'visit', 'The type of ad that originated the visit.'); + + $this->registerDimension('siteDomain', 'base.site', 'domain', 'Site Domain', 'visit', 'The domain of the site.'); + $this->registerDimension('siteName', 'base.site', 'name', 'Site Name', 'visit', 'The name of the site.'); + $this->registerDimension('siteId', 'base.site', 'site_id', 'Site ID', 'visit', 'The ID of the site.'); + $this->registerDimension('userName', 'base.visitor', 'user_name', 'User Name', 'visitor', 'The name or ID of the user.'); + $this->registerDimension('userEmail', 'base.visitor', 'user_email', 'Email Address', 'visitor', 'The email address of the user.'); + + // Date and time oriented dimensions + $this->registerDimension('date', 'base.session', 'yyyymmdd', 'Date', 'visit', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('day', 'base.session', 'day', 'Day', 'visit', 'The day.', '', true); + $this->registerDimension('month', 'base.session', 'month', 'Month', 'visit', 'The month.', '', true); + $this->registerDimension('year', 'base.session', 'year', 'Year', 'visit', 'The year.', '', true); + $this->registerDimension('dayofweek', 'base.session', 'dayofweek', 'Day of Week', 'visit', 'The day of the week.', '', true); + $this->registerDimension('dayofyear', 'base.session', 'dayofyear', 'Day of Year', 'visit', 'The day of the year.', '', true); + $this->registerDimension('weekofyear', 'base.session', 'weekofyear', 'Week of Year', 'visit', 'The week of the year.', '', true); + $this->registerDimension('siteId', 'base.session', 'site_id', 'Site ID', 'visit', 'The ID of the the web site.', '', true); + $this->registerDimension('daysSinceLastVisit', 'base.session', 'days_since_prior_session', 'Days Since Last Visit', 'visit', 'The number of days since the last visit.', '', true); + $this->registerDimension('daysSinceFirstVisit', 'base.session', 'days_since_first_session', 'Days Since First Visit', 'visit', 'The number of days since the first visit of the user.', '', true); + + $this->registerDimension('priorVisitCount', 'base.session', 'num_prior_sessions', 'Prior Visits', 'visit', 'The number of prior visits, excluding the current one.', '', true); + + $this->registerDimension('priorVisitCount', 'base.request', 'num_prior_sessions', 'Prior Visits', 'visit', 'The number of prior visits, excluding the current one.', '', true); + + $this->registerDimension('date', 'base.request', 'yyyymmdd', 'Date', 'visit', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('day', 'base.request', 'day', 'Day', 'visit', 'The day.', '', true); + $this->registerDimension('month', 'base.request', 'month', 'Month', 'visit', 'The month.', '', true); + $this->registerDimension('year', 'base.request', 'year', 'Year', 'visit', 'The year.', '', true); + $this->registerDimension('dayofweek', 'base.request', 'dayofweek', 'Day of Week', 'visit', 'The day of the week.', '', true); + $this->registerDimension('dayofyear', 'base.request', 'dayofyear', 'Day of Year', 'visit', 'The day of the year.', '', true); + $this->registerDimension('weekofyear', 'base.request', 'weekofyear', 'Week of Year', 'visit', 'The week of the year.', '', true); + $this->registerDimension('siteId', 'base.request', 'site_id', 'Site ID', 'visit', 'The ID of the the web site.', '', true); + + $this->registerDimension('actionName', 'base.action_fact', 'action_name', 'Action Name', 'actions', 'The name of the action.', '', true); + $this->registerDimension('actionGroup', 'base.action_fact', 'action_group', 'Action Group', 'actions', 'The group that an action belongs to.', '', true); + $this->registerDimension('actionLabel', 'base.action_fact', 'action_label', 'Action Label', 'actions', 'The label associated with an action.', '', true); + $this->registerDimension('date', 'base.action_fact', 'yyyymmdd', 'Date', 'action', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('siteId', 'base.acton_fact', 'site_id', 'Site ID', 'visit', 'The ID of the the web site.', '', true); + + // visit + $this->registerDimension('entryPageUrl', 'base.document', 'url', 'Entry Page URL', 'visit', 'The URL of the entry page.', 'first_page_id'); + $this->registerDimension('entryPagePath', 'base.document', 'uri', 'Entry Page Path', 'visit', 'The URI of the entry page.', 'first_page_id'); + $this->registerDimension('entryPageTitle', 'base.document', 'page_title', 'Entry Page Title', 'visit', 'The title of the entry page.', 'first_page_id'); + $this->registerDimension('entryPageType', 'base.document', 'page_type', 'Entry Page Type', 'visit', 'The page type of the entry page.', 'first_page_id'); + $this->registerDimension('exitPageUrl', 'base.document', 'url', 'Exit Page URL', 'visit', 'The URL of the exit page.', 'last_page_id'); + $this->registerDimension('exitPagePath', 'base.document', 'uri', 'Exit Page Path', 'visit', 'The URI of the exit page.', 'last_page_id'); + $this->registerDimension('exitPageTitle', 'base.document', 'page_title', 'Exit Page Title', 'visit', 'The title of the exit page.', 'last_page_id'); + $this->registerDimension('exitPageType', 'base.document', 'page_type', 'Exit Page Type', 'visit', 'The page type of the exit page.', 'last_page_id'); + $this->registerDimension('priorPageUrl', 'base.document', 'url', 'Prior Page URL', 'visit', 'The URL of the prior page.', 'prior_document_id'); + $this->registerDimension('priorPagePath', 'base.document', 'uri', 'Prior Page Path', 'visit', 'The URI of the prior page.', 'prior_document_id'); + $this->registerDimension('priorPageTitle', 'base.document', 'page_title', 'Prior Page Title', 'visit', 'The title of the prior page.', 'prior_document_id'); + $this->registerDimension('priorPageType', 'base.document', 'page_type', 'Prior Page Type', 'visit', 'The page type of the prior page.', 'prior_document_id'); + + // traffic sources + $this->registerDimension('referralPageUrl', 'base.referer', 'url', 'Referral Page URL', 'traffic sources', 'The url of the referring web page.'); + $this->registerDimension('referralPageTitle', 'base.referer', 'page_title', 'Referral Page Title', 'traffic sources', 'The title of the referring web page.'); + $this->registerDimension('referralSearchTerms', 'base.search_term_dim', 'terms', 'Search Terms', 'traffic sources', 'The referring search terms.', 'referring_search_term_id'); + $this->registerDimension('referralLinkText', 'base.referer', 'refering_anchortext', 'Referral Link Text', 'traffic sources', 'The text of the referring link.'); + $this->registerDimension('isSearchEngine', 'base.referer', 'is_searchengine', 'Search Engine', 'traffic sources', 'Is traffic source a search engine.'); + $this->registerDimension('referralWebSite', 'base.referer', 'site', 'Referral Web Site', 'traffic sources', 'The full domain of the referring web site.'); + + // content + $this->registerDimension('pageUrl', 'base.document', 'url', 'Page URL', 'content', 'The URL of the web page.', 'document_id'); + $this->registerDimension('pagePath', 'base.document', 'uri', 'Page Path', 'content', 'The path of the web page.', 'document_id'); + $this->registerDimension('pageTitle', 'base.document', 'page_title', 'Page Title', 'content', 'The title of the web page.', 'document_id'); + $this->registerDimension('pageType', 'base.document', 'page_type', 'Page Type', 'content', 'The page type of the web page.', 'document_id'); + + // feeds + $this->registerDimension('date', 'base.feed_request', 'yyyymmdd', 'Date', 'date', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('day', 'base.feed_request', 'day', 'Day', 'date', 'The day.', '', true); + $this->registerDimension('month', 'base.feed_request', 'month', 'Month', 'date', 'The month.', '', true); + $this->registerDimension('year', 'base.feed_request', 'year', 'Year', 'date', 'The year.', '', true); + $this->registerDimension('dayofweek', 'base.feed_request', 'dayofweek', 'Day of Week', 'date', 'The day of the week.', '', true); + $this->registerDimension('dayofyear', 'base.feed_request', 'dayofyear', 'Day of Year', 'date', 'The day of the year.', '', true); + $this->registerDimension('weekofyear', 'base.feed_request', 'weekofyear', 'Week of Year', 'date', 'The week of the year.', '', true); + $this->registerDimension('feedType', 'base.feed_request', 'feed_format', 'Feed Type', 'feed', 'The type or format of the feed.', '', true); + $this->registerDimension('siteId', 'base.feed_request', 'site_id', 'Site ID', 'request', 'The ID of the the web site.', '', true); + + //clicks + $this->registerDimension('date', 'base.click', 'yyyymmdd', 'Date', 'visit', 'The date.', '', true, 'yyyymmdd'); + // IDs + $this->registerDimension('visitorId', 'base.visitor', 'id', 'Visitor ID', 'visitor', 'The ID of the visitor.'); + $this->registerDimension('sessionId', 'base.session', 'id', 'Session ID', 'visit', 'The ID of the session/visit.'); + + $this->registerDimension('daysToTransaction', 'base.commerce_transaction_fact', 'days_since_first_session', 'Days To Purchase', 'ecommerce', 'The number of days since the first visit and an e-commerce transaction.', '', true); + $this->registerDimension('visitsToTransaction', 'base.commerce_transaction_fact', 'num_prior_sessions', 'Visits To Purchase', 'ecommerce', 'The number of visits prior to an e-commerce transaction.', '', true); + + // productName + $this->registerDimension( + 'productName', + 'base.commerce_line_item_fact', + 'product_name', + 'Product Name', + 'ecommerce', + 'The name of the product purchased.', + '', + true + ); + // productSku + $this->registerDimension('productSku', 'base.commerce_line_item_fact', 'sku', 'Product SKU', 'ecommerce', 'The SKU code of the product purchased.', '', true); + // productCategory + $this->registerDimension('productCategory', 'base.commerce_line_item_fact', 'category', 'Product Category', 'ecommerce', 'The category of product purchased.', '', true); + // transactionOriginator + $this->registerDimension('transactionOriginator', 'base.commerce_transaction_fact', 'order_source', 'Originator', 'ecommerce', 'The store or location that originated the transaction.', '', true); + // transactionId + $this->registerDimension('transactionId', 'base.commerce_transaction_fact', 'order_id', 'Transaction ID', 'ecommerce', 'The id of the e-commerce transaction.', '', true); + $this->registerDimension('transactionGateway', 'base.commerce_transaction_fact', 'gateway', 'Payment Gateway', 'ecommerce', 'The payment gateway or provider used in the e-commerce transaction.', '', true); + // daysToTransaction + $this->registerDimension('daysToTransaction', 'base.commerce_transaction_fact', 'days_since_first_session', "Days To Purchase', 'ecommerce', 'The number of days between the visitor's first visit and when transaction occurred.", '', true); + // visitsToTransaction + $this->registerDimension('visitsToTransaction', 'base.commerce_transaction_fact', 'num_prior_sessions', "Visits To Purchase', 'ecommerce', 'The number of visits before the transaction occurred.", '', true); + $this->registerDimension('date', 'base.commerce_line_item_fact', 'yyyymmdd', 'Date', 'ecommerce', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('date', 'base.commerce_transaction_fact', 'yyyymmdd', 'Date', 'ecommerce', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('timestamp', 'base.commerce_transaction_fact', 'timestamp', 'Time', 'ecommerce', 'The timestamp of the transaction.', '', true); + $this->registerDimension('siteId', 'base.commerce_line_item_fact', 'site_id', 'Site Id', 'ecommerce', 'The site ID.', '', true, 'site_id'); + $this->registerDimension('siteId', 'base.commerce_transaction_fact', 'site_id', 'Site Id', 'ecommerce', 'The site ID.', '', true, 'site_id'); + // dom clicks + $this->registerDimension('siteId', 'base.click', 'site_id', 'Site Id', 'site', 'The site ID.', '', true, 'site_id'); + $this->registerDimension('date', 'base.click', 'yyyymmdd', 'Date', 'date', 'The date.', '', true, 'yyyymmdd'); + $this->registerDimension('domElementId', 'base.click', 'dom_element_id', 'Dom ID', 'dom', 'The id of the dom element.', '', true); + $this->registerDimension('domElementName', 'base.click', 'dom_element_name', 'Dom Name', 'dom', 'The name of the dom element.', '', true); + $this->registerDimension('domElementText', 'base.click', 'dom_element_text', 'Dom Text', 'dom', 'The text associated the dom element.', '', true); + $this->registerDimension('domElementValue', 'base.click', 'dom_element_value', 'Dom Value', 'dom', 'The value of the dom element.', '', true); + $this->registerDimension('domElementTag', 'base.click', 'dom_element_tag', 'Dom Tag', 'dom', 'The html tag of the dom element.', '', true); + $this->registerDimension('domElementClass', 'base.click', 'dom_element_class', 'Dom Class', 'dom', 'The class of the dom element.', '', true); + + /** + * Register CLI Commands + * + * The following lines register various command line interface (CLI) controller. + */ + $this->registerCliCommand('update', 'base.updatesApplyCli'); + $this->registerCliCommand('build', 'base.build'); + $this->registerCliCommand('flush-cache', 'base.flushCacheCli'); + $this->registerCliCommand('processEventQueue', 'base.processEventQueue'); + $this->registerCliCommand('install', 'base.installCli'); + $this->registerCliCommand('activate', 'base.moduleActivateCli'); + $this->registerCliCommand('deactivate', 'base.moduleDeactivateCli'); + $this->registerCliCommand('install-module', 'base.moduleInstallCli'); + + /** + * Register API methods + * + * The following lines register various API methods. + */ + $this->registerApiMethod('getResultSet', + array($this, 'getResultSet'), + array( + 'metrics', + 'dimensions', + 'siteId', + 'constraints', + 'sort', + 'resultsPerPage', + 'page', + 'offset', + 'period', + 'startDate', + 'endDate', + 'startTime', + 'endTime', + 'format'), + '', + 'view_reports' + ); + + $this->registerApiMethod('getDomstreams', + array( $this, 'getDomstreams' ), + array( + 'startDate', + 'endDate', + 'document_id', + 'siteId', + 'resultsPerPage', + 'page', + 'format' ), + '', + 'view_reports' + ); + + $this->registerApiMethod('getLatestVisits', + array($this, 'getLatestVisits'), + array( 'startDate', 'endDate', 'visitorId', 'siteId', 'resultsPerPage', 'page', 'format'), + '', + 'view_reports' + ); + + $this->registerApiMethod('getClickstream', + array($this, 'getClickstream'), + array( 'sessionId', 'resultsPerPage', 'page','format'), + '', + 'view_reports' + ); + + $this->registerApiMethod('getVisitDetail', + array($this, 'getVisitDetail'), + array( 'sessionId', 'format'), + '', + 'view_reports' + ); + + $this->registerApiMethod('getTransactionDetail', + array($this, 'getTransactionDetail'), + array( 'transactionId', 'format'), + '', + 'view_reports' + ); + + $this->registerApiMethod('getDomClicks', + array($this, 'getDomClicks'), + array( + 'pageUrl', + 'siteId', + 'startDate', + 'endDate', + 'document_id', + 'period', + 'resultsPerPage', + 'page', + 'format' + ), + '', + 'view_reports' + ); + + $this->registerApiMethod('getTransactions', + array($this, 'getTransactions'), + array( + 'siteId', + 'startDate', + 'endDate', + 'period', + 'sort', + 'resultsPerPage', + 'page', + 'format' + ), + '', + 'view_reports' + ); + + $this->registerApiMethod('getDomstream', + array($this, 'getDomstream'), + array('domstream_guid'), + '', + 'view_reports' + ); + + return parent::__construct(); + } + + /** + * Registers Admin panels + * + */ + function registerAdminPanels() { + + $this->addAdminPanel(array( + 'do' => 'base.optionsGeneral', + 'priviledge' => 'admin', + 'anchortext' => 'Main Configuration', + 'group' => 'General', + 'order' => 1) + ); + + $this->addAdminPanel(array( + 'do' => 'base.users', + 'priviledge' => 'admin', + 'anchortext' => 'User Management', + 'group' => 'General', + 'order' => 2) + ); + + + + $this->addAdminPanel(array( + 'do' => 'base.sites', + 'priviledge' => 'admin', + 'anchortext' => 'Tracked Sites', + 'group' => 'General', + 'order' => 3) + ); + + $this->addAdminPanel(array( + 'do' => 'base.optionsModules', + 'priviledge' => 'admin', + 'anchortext' => 'Modules', + 'group' => 'General', + 'order' => 3) + ); + + /* + $this->addAdminPanel(array( + 'do' => 'base.optionsGoals', + 'priviledge' => 'admin', + 'anchortext' => 'Goal Settings', + 'group' => 'General', + 'order' => 3) + ); + */ + } + + function registerNavigation() { + + $this->addNavigationLink('Reports', '', 'base.reportDashboard', 'Dashboard', 1); + $this->addNavigationLink('Reports', '', 'base.reportVisitors', 'Visitors', 3); + + $this->addNavigationLink('Reports', '', 'base.reportContent', 'Content', 4); + + $this->addNavigationLink('Reports', '', 'base.reportEcommerce', 'Ecommerce', 1); + $this->addNavigationLink('Reports', 'Ecommerce', 'base.reportRevenue', 'Revenue', 2); + $this->addNavigationLink('Reports', 'Ecommerce', 'base.reportTransactions', 'Transactions', 3); + $this->addNavigationLink('Reports', 'Ecommerce', 'base.reportVisitsToPurchase', 'Visits To Purchase', 4); + $this->addNavigationLink('Reports', 'Ecommerce', 'base.reportDaysToPurchase', 'Days To Purchase', 5); + + $this->addNavigationLink('Reports', 'Content', 'base.reportPages', 'Top Pages', 1); + $this->addNavigationLink('Reports', 'Content', 'base.reportPageTypes', 'Page Types', 2); + $this->addNavigationLink('Reports', 'Content', 'base.reportFeeds', 'Feeds', 7); + $this->addNavigationLink('Reports', 'Content', 'base.reportEntryPages', 'Entry Pages', 3); + $this->addNavigationLink('Reports', 'Content', 'base.reportExitPages', 'Exit Pages', 4); + $this->addNavigationLink('Reports', 'Content', 'base.reportDomstreams', 'Domstreams', 5); + $this->addNavigationLink('Reports', '', 'base.reportActionTracking', 'Action Tracking', 1); + $this->addNavigationLink('Reports', 'Action Tracking', 'base.reportActionGroups', 'Action Groups', 2); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportGeolocation', 'Geo-location', 1); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportHosts', 'Domains', 2); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportVisitorsLoyalty', 'Visitor Loyalty', 3); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportVisitorsRecency', 'Visitor Recency', 4); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportVisitorsAge', 'Visitor Age', 5); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportBrowsers', 'Browser Types', 6); + $this->addNavigationLink('Reports', 'Visitors', 'base.reportOs', 'Operating Systems', 7); + + $this->addNavigationLink('Reports', '', 'base.reportTraffic', 'Traffic', 2); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportKeywords', 'Search Terms', 1); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportAnchortext', 'Inbound Link Text', 2); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportSearchEngines', 'Search Engines', 3); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportReferringSites', 'Referring Web Sites', 4); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportCampaigns', 'Campaigns', 5); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportAds', 'Ad Performance', 6); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportAdTypes', 'Ad Types', 7); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportCreativePerformance', 'Creative Performance', 8); + $this->addNavigationLink('Reports', 'Traffic', 'base.reportAttributionHistory', 'Attribution History', 8); + $this->addNavigationLink('Reports', '', 'base.reportGoals', 'Goals', 5); + $this->addNavigationLink('Reports', 'Goals', 'base.reportGoalFunnel', 'Funnel Visualization', 1); + + } +