diff --git a/config/referral-rewriter-tag.php b/config/referral-rewriter-tag.php index 927a50b..d5f6b93 100644 --- a/config/referral-rewriter-tag.php +++ b/config/referral-rewriter-tag.php @@ -2,5 +2,15 @@ // config for The3LabsTeam/ReferralRewriterTag return [ - + 'ebay' => [ + 'tag' => '', + 'subtag' => '', + ], + 'amazon' => [ + 'tag' => '', + 'subtag' => '', + ], + 'instantgaming' => [ + 'tag' => '', + ], ]; diff --git a/src/ReferralRewriterTag.php b/src/ReferralRewriterTag.php index e31f65b..d968baf 100755 --- a/src/ReferralRewriterTag.php +++ b/src/ReferralRewriterTag.php @@ -35,6 +35,14 @@ public function rewrite(string $link, ?string $tag, ?string $subtag, string $add */ public function rewriteAmazonLink(): string { + if(!$this->tag) { + $this->tag = config('referral-rewriter-tag.amazon.tag'); + } + + if(!$this->subtag) { + $this->subtag = config('referral-rewriter-tag.amazon.subtag'); + } + return $this->rewriteLink(tagKey: 'tag', subTagKey: 'ascsubtag'); } @@ -43,6 +51,14 @@ public function rewriteAmazonLink(): string */ public function rewriteInstantGamingLink(): string { + if(!$this->tag) { + $this->tag = config('referral-rewriter-tag.instantgaming.tag'); + } + + if(!$this->subtag) { + $this->subtag = config('referral-rewriter-tag.instantgaming.subtag'); + } + return $this->rewriteLink(tagKey: 'igr', subTagKey: 'igr_extra'); } @@ -51,6 +67,14 @@ public function rewriteInstantGamingLink(): string */ public function rewriteEbayLink(): string { + if(!$this->tag) { + $this->tag = config('referral-rewriter-tag.ebay.tag'); + } + + if(!$this->subtag) { + $this->subtag = config('referral-rewriter-tag.ebay.subtag'); + } + return $this->rewriteLink(tagKey: 'campid', subTagKey: 'customid'); }