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

Commit

Permalink
Merge pull request #49 from tuimz/allow-extension
Browse files Browse the repository at this point in the history
Allow setting Trackingid after initialization
  • Loading branch information
justb81 authored May 3, 2018
2 parents a95158f + de91101 commit 640e452
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
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
12 changes: 12 additions & 0 deletions src/Ipunkt/LaravelAnalytics/Providers/GoogleAnalytics.php
Original file line number Diff line number Diff line change
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 640e452

Please sign in to comment.