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

Commit

Permalink
Adjusting PR
Browse files Browse the repository at this point in the history
Instead of making $trackingId protected, added a function which can set the $trackingId variable
  • Loading branch information
tuimz committed May 3, 2018
1 parent e1fae2a commit de91101
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ public function ecommerceAddItem($id, $name, $sku = null, $category = null, $pri
*/
public function setCustom($dimension, $value = null);

/**
* set a custom tracking ID (the UA-XXXXXXXX-1 code)
*
* @param string $trackingId
*
* @return AnalyticsProviderInterface
*/
public function setTrackingId($trackingId);

/**
* enables Content Security Polity and sets nonce
*
Expand Down
14 changes: 13 additions & 1 deletion src/Ipunkt/LaravelAnalytics/Providers/GoogleAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GoogleAnalytics implements AnalyticsProviderInterface
*
* @var string
*/
protected $trackingId;
private $trackingId;

/**
* tracking domain
Expand Down Expand Up @@ -733,4 +733,16 @@ protected function _getJavascriptTemplateBlockEnd()
? '</script>'
: '';
}

/**
* set a custom tracking ID (the UA-XXXXXXXX-1 code)
*
* @param string $trackingId
*
* @return AnalyticsProviderInterface
*/
public function setTrackingId( $trackingId ) {
$this->trackingId = $trackingId;
return $this;
}
}
11 changes: 11 additions & 0 deletions src/Ipunkt/LaravelAnalytics/Providers/NoAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,15 @@ public function cspNonce()
{
return null;
}

/**
* set a custom tracking ID (the UA-XXXXXXXX-1 code)
*
* @param string $trackingId
*
* @return AnalyticsProviderInterface
*/
public function setTrackingId( $trackingId ) {
return $this;
}
}

0 comments on commit de91101

Please sign in to comment.