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

Commit de91101

Browse files
committed
Adjusting PR
Instead of making $trackingId protected, added a function which can set the $trackingId variable
1 parent e1fae2a commit de91101

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

src/Ipunkt/LaravelAnalytics/Contracts/AnalyticsProviderInterface.php

+9
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,15 @@ public function ecommerceAddItem($id, $name, $sku = null, $category = null, $pri
213213
*/
214214
public function setCustom($dimension, $value = null);
215215

216+
/**
217+
* set a custom tracking ID (the UA-XXXXXXXX-1 code)
218+
*
219+
* @param string $trackingId
220+
*
221+
* @return AnalyticsProviderInterface
222+
*/
223+
public function setTrackingId($trackingId);
224+
216225
/**
217226
* enables Content Security Polity and sets nonce
218227
*

src/Ipunkt/LaravelAnalytics/Providers/GoogleAnalytics.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GoogleAnalytics implements AnalyticsProviderInterface
2222
*
2323
* @var string
2424
*/
25-
protected $trackingId;
25+
private $trackingId;
2626

2727
/**
2828
* tracking domain
@@ -733,4 +733,16 @@ protected function _getJavascriptTemplateBlockEnd()
733733
? '</script>'
734734
: '';
735735
}
736+
737+
/**
738+
* set a custom tracking ID (the UA-XXXXXXXX-1 code)
739+
*
740+
* @param string $trackingId
741+
*
742+
* @return AnalyticsProviderInterface
743+
*/
744+
public function setTrackingId( $trackingId ) {
745+
$this->trackingId = $trackingId;
746+
return $this;
747+
}
736748
}

src/Ipunkt/LaravelAnalytics/Providers/NoAnalytics.php

+11
Original file line numberDiff line numberDiff line change
@@ -306,4 +306,15 @@ public function cspNonce()
306306
{
307307
return null;
308308
}
309+
310+
/**
311+
* set a custom tracking ID (the UA-XXXXXXXX-1 code)
312+
*
313+
* @param string $trackingId
314+
*
315+
* @return AnalyticsProviderInterface
316+
*/
317+
public function setTrackingId( $trackingId ) {
318+
return $this;
319+
}
309320
}

0 commit comments

Comments
 (0)