# GoSquared People integration - how to get user name and email in Javascript at \<head\> customization?

**URL:** <https://meta.discourse.org/t/gosquared-people-integration-how-to-get-user-name-and-email-in-javascript-at-head-customization/44917>\
**Category:** Product Support\
**Created:** [27 במאי,‏ 2016,‏ 6:48pm UTC](https://meta.discourse.org/t/gosquared-people-integration-how-to-get-user-name-and-email-in-javascript-at-head-customization/44917 "2016-05-27T18:48:23Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Chopper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chopper/32/57073_2.png) [@Chopper](https://meta.discourse.org/u/Chopper)\
**Post date:** [29 במאי,‏ 2016,‏ 11:18am UTC](https://meta.discourse.org/t/gosquared-people-integration-how-to-get-user-name-and-email-in-javascript-at-head-customization/44917/3 "2016-05-29T11:18:44Z")

</div>

I will do something like this :

1. get username with the current session
2. get the rest now you have the username with the API

* * *

```javascript
$(document).ready(function() {
    $.ajax({
        type: 'GET',
        cache: false,
        url: 'https://discoruse.forum.com/session/current.json',
        dataType: 'json',
        xhrFields: {
            'withCredentials': true
        },
        success: function(result){
            // you get the username
            result = result.current_user;
            var user_name = result.username;
            var user_id = result.id;
            var user_avatar = result.avatar_template;
            $.ajax({
                type: 'GET',
                cache: false,
                url: 'https://forum.com/users/' + user_name + '/activity.json',
                dataType: 'json',
                xhrFields: {
                    'withCredentials': true
                },
                success: function(result){
                    // you get the email and date of registration
                    result = result.user;
                    var user_email = result.email;
                    var user_registation = result.created_at

                },
                error: function(result){
                    console.log('Error: '+result);
                }
            });
        },
        error: function(result){
            console.log('Error: '+result);
        }
    });

});

```

* * *

You can insert this code into the body from the admin panel → cutomization

---

_[View the full topic](https://meta.discourse.org/t/gosquared-people-integration-how-to-get-user-name-and-email-in-javascript-at-head-customization/44917)._
