Skip to content

Commit

Permalink
Adds track without a location lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
yordadev committed Oct 7, 2024
1 parent c69e086 commit d40a3ca
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Services/ClickService.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class ClickService
public static int $CLIENT_INITIATED_QRCODE = 9;

/**
* @param string $identifier
* @param string $request_ip
* @param int $outcome_id
* @param string|null $domain
* @param array $headers
* @throws ClickServiceException
*/
public static function track(string $identifier, string $request_ip, int $outcome_id, ?string $domain = null, array $headers = []): void
Expand All @@ -71,6 +76,33 @@ public static function track(string $identifier, string $request_ip, int $outcom
}
}

/**
* @param string $identifier
* @param string $request_ip
* @param int $outcome_id
* @param string|null $domain
* @param array $headers
* @return void
* @throws ClickServiceException
*/
public static function trackWithoutLookup(string $identifier, string $request_ip, int $outcome_id, ?string $domain = null, array $headers = []): void
{
$request_ip = config('location.testing.enabled') ? config('location.testing.ip') : $request_ip;

try {
ClickRepository::createClick(
UrlRepository::findByDomainIdentifier($domain, $identifier)->id,
LocationRepository::findOrCreateLocationRecord(
LocationRepository::locationUnknown($request_ip)
)->id,
$outcome_id,
$headers
);
} catch (Exception $exception) {
throw new ClickServiceException($exception->getMessage());
}
}

/**
* @throws FilterClicksStrategyException
* @throws Throwable
Expand Down

0 comments on commit d40a3ca

Please sign in to comment.