Skip to content

Commit

Permalink
Fixed #221 -- Google Analytics User ID
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmoura committed Sep 24, 2019
1 parent 39e4eb3 commit e43b4cd
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions client/business/authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
$cookie = UserData::sendCookie($result["userTK"], true);
setcookie("userData", $cookie, $remember_me, '/', COOKIE_DOMAIN_SCOPE);
setcookie("userTK", $result["userTK"], $remember_me, '/', COOKIE_DOMAIN_SCOPE);
setcookie("userID", $_SESSION["userID"], $remember_me, '/', COOKIE_DOMAIN_SCOPE);

// SSO LOGIN
if(ENABLE_SSO_LOGIN){
Expand Down
1 change: 1 addition & 0 deletions client/business/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/* destroy session data */
session_destroy();
$_SESSION = array();
setcookie('userID','',time() -3600,'/',COOKIE_DOMAIN_SCOPE);
setcookie('userTK','',time() -3600,'/',COOKIE_DOMAIN_SCOPE);
setcookie('userData','',time() -3600,'/',COOKIE_DOMAIN_SCOPE);
$send_cookie = 'logout'; // remove cookie from .bvs.br
Expand Down
6 changes: 1 addition & 5 deletions client/classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,14 @@ public static function sendCookie($userTK,$return=false){

$src = BVS_COOKIE_DOMAIN.'/cookies.php?userData='.$userData;

if ( $return ) {
return $userData;
} else {

?>
<script type="text/javascript">
var element = document.createElement("img");
element.setAttribute('src', "<?php echo $src; ?>");
</script>
<?php

}
if ( $return ) return $userData;
}

}
Expand Down
2 changes: 2 additions & 0 deletions client/templates/default/header.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@
if (navigator.userAgent.indexOf('gonative') > -1) {
__gaTracker('create', '<?php echo APP_GOOGLE_ANALYTICS; ?>', 'auto');
__gaTracker('send', 'pageview');
__gaTracker('set', 'userId', '<?php echo $_SESSION["userID"]; ?>'); // Set the user ID using signed-in user_id.
} else {
__gaTracker('create', '<?php echo GOOGLE_ANALYTICS; ?>', 'auto');
__gaTracker('send', 'pageview');
__gaTracker('set', 'userId', '<?php echo $_SESSION["userID"]; ?>'); // Set the user ID using signed-in user_id.
}
</script>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion server/classes/UserDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ public static function changePassword($userID, $oldPassword, $newPassword){
$newToken = Token::makeUserTK($userID,$newPassword,'ldap');
$_SESSION['userTK'] = $newToken;
setcookie("userTK", $_SESSION["userTK"], 0, '/', COOKIE_DOMAIN_SCOPE);
//UserData::sendCookie($result["userTK"]);
// UserData::sendCookie($result["userTK"]);
}
} else {
$retValue = 'invalidpass';
Expand Down
1 change: 1 addition & 0 deletions server/pub/include/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/* destroy session data */
session_destroy();
$_SESSION = array();
setcookie('userID','',time() -3600,'/',COOKIE_DOMAIN_SCOPE);
setcookie('userTK','',time() -3600,'/',COOKIE_DOMAIN_SCOPE);
setcookie('userData','',time() -3600,'/',COOKIE_DOMAIN_SCOPE);
$send_cookie = 'logout'; // remove cookie from .bvs.br
Expand Down
2 changes: 2 additions & 0 deletions server/templates/default/header.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@
if (navigator.userAgent.indexOf('gonative') > -1) {
__gaTracker('create', '<?php echo APP_GOOGLE_ANALYTICS; ?>', 'auto');
__gaTracker('send', 'pageview');
__gaTracker('set', 'userId', '<?php echo $_SESSION["userID"]; ?>'); // Set the user ID using signed-in user_id.
} else {
__gaTracker('create', '<?php echo GOOGLE_ANALYTICS; ?>', 'auto');
__gaTracker('send', 'pageview');
__gaTracker('set', 'userId', '<?php echo $_SESSION["userID"]; ?>'); // Set the user ID using signed-in user_id.
}
</script>
<?php endif; ?>
Expand Down

0 comments on commit e43b4cd

Please sign in to comment.