added referer website to visitor

pull/44/head
A1Gard 4 months ago
parent 3166710510
commit 264e5faed0

@ -306,4 +306,14 @@ class TVisitor {
// return $result; // return $result;
// } // }
public static function getRefererDomain() {
if(isset($_SERVER['HTTP_REFERER'])) {
$referer = parse_url($_SERVER['HTTP_REFERER']);
$domain = isset($referer['host']) ? $referer['host'] : null;
return $domain;
} else {
return null;
}
}
} }

@ -25,6 +25,7 @@ class VisitorCounter
$visitor->browser = TVisitor::DetectBrowser(); $visitor->browser = TVisitor::DetectBrowser();
$visitor->os = TVisitor::DetectOS(); $visitor->os = TVisitor::DetectOS();
$visitor->version = TVisitor::BrowserVersion(); $visitor->version = TVisitor::BrowserVersion();
$visitor->referer = TVisitor::getRefererDomain();
$ref = TVisitor::GetKeyword(); $ref = TVisitor::GetKeyword();
if ($ref !== null) { if ($ref !== null) {
$visitor->keywords = $ref['keyword']; $visitor->keywords = $ref['keyword'];

@ -21,6 +21,7 @@ return new class extends Migration
$table->string('version')->nullable(); $table->string('version')->nullable();
$table->string('display')->nullable(); $table->string('display')->nullable();
$table->string('keywords')->nullable(); $table->string('keywords')->nullable();
$table->string('referer')->nullable();
$table->boolean('is_mobile')->default(false); $table->boolean('is_mobile')->default(false);
$table->string('page')->nullable(); $table->string('page')->nullable();
$table->timestamps(); $table->timestamps();

Loading…
Cancel
Save