mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
Addressed review comments.
This commit is contained in:
parent
258762da47
commit
37b51b8fd1
3 changed files with 15 additions and 6 deletions
|
@ -12,7 +12,8 @@ class Session
|
||||||
const NAMESPACE_DEFAULT = 'default',
|
const NAMESPACE_DEFAULT = 'default',
|
||||||
NAMESPACE_FLASH = 'flash',
|
NAMESPACE_FLASH = 'flash',
|
||||||
NAMESPACE_FLASH_REMOVE = 'flash_remove',
|
NAMESPACE_FLASH_REMOVE = 'flash_remove',
|
||||||
USER_ID = 'user_id';
|
USER_ID = 'user_id',
|
||||||
|
SITE_ID = 'lbry.io';
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
|
@ -33,8 +34,15 @@ class Session
|
||||||
static::setNamespace(static::NAMESPACE_DEFAULT, $oldSession);
|
static::setNamespace(static::NAMESPACE_DEFAULT, $oldSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = LBRY::logWebVisitor('lbry.io', $_SESSION[static::USER_ID], $_SERVER['REMOTE_ADDR']);
|
$site_visitor_id = key_exists(static::USER_ID,$_SESSION) ? $_SESSION[static::USER_ID] : '';
|
||||||
|
$response = LBRY::logWebVisitor(static::SITE_ID, $site_visitor_id, $_SERVER['REMOTE_ADDR']);
|
||||||
|
if (key_exists('data',$response) && key_exists('visitor_id',$response['data']))
|
||||||
|
{
|
||||||
$_SESSION[static::USER_ID] = $response['data']['visitor_id'];
|
$_SESSION[static::USER_ID] = $response['data']['visitor_id'];
|
||||||
|
}else{
|
||||||
|
$_SESSION[static::USER_ID] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static::initFlashes();
|
static::initFlashes();
|
||||||
}
|
}
|
||||||
|
|
3
lib/thirdparty/LBRY.class.php
vendored
3
lib/thirdparty/LBRY.class.php
vendored
|
@ -77,7 +77,10 @@ class LBRY
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function logWebVisitor($site, $visitorID, $IPAddress)
|
public static function logWebVisitor($site, $visitorID, $IPAddress)
|
||||||
|
{
|
||||||
|
if (IS_PRODUCTION)
|
||||||
{
|
{
|
||||||
return Curl::post(static::getApiUrl("/visitor/new"), ['site' => $site, 'visitor_id' => $visitorID, 'ip_address' => $IPAddress], ['json_response' => true]);
|
return Curl::post(static::getApiUrl("/visitor/new"), ['site' => $site, 'visitor_id' => $visitorID, 'ip_address' => $IPAddress], ['json_response' => true]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
fbq('init', '1618717031725766',{uid: '<?php echo $_SESSION[Session::USER_ID] ?>'}));
|
fbq('init', '1618717031725766',{uid: '<?php echo $_SESSION[Session::USER_ID] ?>'}));
|
||||||
fbq('track', '<?php echo Response::getFacebookPixelAnalyticsType() ?>');
|
fbq('track', '<?php echo Response::getFacebookPixelAnalyticsType() ?>');
|
||||||
|
|
||||||
<?php LBRY::logWebVisitor('lbry.io', $_SESSION[Session::USER_ID], $_SERVER['REMOTE_ADDR'])?>
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue