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

Commit 640e452

Browse files
authored
Merge pull request #49 from tuimz/allow-extension
Allow setting Trackingid after initialization
2 parents a95158f + de91101 commit 640e452

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
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

+12
Original file line numberDiff line numberDiff line change
@@ -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)