Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
updated interface code
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Kummer committed Mar 5, 2015
1 parent fd3cdc0 commit c49ae9a
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

/**
* Interface AnalyticsProviderInterface
*
* @package Ipunkt\LaravelAnalytics\Contracts
*/
interface AnalyticsProviderInterface
Expand Down Expand Up @@ -48,17 +49,31 @@ public function trackEvent($category, $action, $label, $value);
*/
public function trackCustom($customCode);

/**
* enable display features
*
* @return AnalyticsProviderInterface
*/
public function enableDisplayFeatures();

/**
* disable display features
*
* @return AnalyticsProviderInterface
*/
public function disableDisplayFeatures();

/**
* enable auto tracking
*
* @return void
* @return AnalyticsProviderInterface
*/
public function enableAutoTracking();

/**
* disable auto tracking
*
* @return void
* @return AnalyticsProviderInterface
*/
public function disableAutoTracking();

Expand All @@ -77,4 +92,16 @@ public function disableAutoTracking();
* @return string
*/
public function trackMeasurementUrl($metricName, $metricValue, Event $event, Campaign $campaign, $clientId = null, array $params = array());

/**
* sets or gets nonInteraction
*
* setting: $this->nonInteraction(true)->render();
* getting: if ($this->nonInteraction()) echo 'non-interaction set';
*
* @param boolean|null $value
*
* @return bool|AnalyticsProviderInterface
*/
public function nonInteraction($value = null);
}
48 changes: 42 additions & 6 deletions src/Ipunkt/LaravelAnalytics/Providers/NoAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* Class NoAnalytics
*
* @package Ipunkt\LaravelAnalytics\Providers
*/
class NoAnalytics implements AnalyticsProviderInterface
Expand All @@ -31,7 +32,6 @@ public function render()
*/
public function trackPage($page, $title, $hittype)
{

}

/**
Expand All @@ -46,7 +46,6 @@ public function trackPage($page, $title, $hittype)
*/
public function trackEvent($category, $action, $label, $value)
{

}

/**
Expand All @@ -58,27 +57,46 @@ public function trackEvent($category, $action, $label, $value)
*/
public function trackCustom($customCode)
{
}

/**
* enable display features
*
* @return NoAnalytics
*/
public function enableDisplayFeatures()
{
return $this;
}

/**
* disable display features
*
* @return NoAnalytics
*/
public function disableDisplayFeatures()
{
return $this;
}

/**
* enable auto tracking
*
* @return void
* @return NoAnalytics
*/
public function enableAutoTracking()
{

return $this;
}

/**
* disable auto tracking
*
* @return void
* @return NoAnalytics
*/
public function disableAutoTracking()
{

return $this;
}

/**
Expand All @@ -99,4 +117,22 @@ public function trackMeasurementUrl($metricName, $metricValue, Event $event, Cam
{
return '';
}

/**
* sets or gets nonInteraction
*
* setting: $this->nonInteraction(true)->render();
* getting: if ($this->nonInteraction()) echo 'non-interaction set';
*
* @param boolean|null $value
*
* @return bool|AnalyticsProviderInterface
*/
public function nonInteraction($value = null)
{
if (null === $value)
return false;

return $this;
}
}

0 comments on commit c49ae9a

Please sign in to comment.