Skip to content

Commit

Permalink
Custom tag and subtag
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudio-Emmolo committed Nov 5, 2024
1 parent bb531a3 commit ecf7b6f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
12 changes: 11 additions & 1 deletion config/referral-rewriter-tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@

// config for The3LabsTeam/ReferralRewriterTag
return [

'ebay' => [
'tag' => '',
'subtag' => '',
],
'amazon' => [
'tag' => '',
'subtag' => '',
],
'instantgaming' => [
'tag' => '',
],
];
24 changes: 24 additions & 0 deletions src/ReferralRewriterTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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');
}

Expand All @@ -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');
}

Expand Down

0 comments on commit ecf7b6f

Please sign in to comment.