Set Registered User IDs from Email

If you have existing users in your database or CRM system, you can set SkyGlue Ids to their existing user IDs.

Using email to set user IDs is a common way to achieve the above goal. You can send emails (e.g. promotion, new release, etc.) to your existing customers that contain a unique  link for each one of them. The link carries user’s registered user Id as a URL query parameter. For example: http://mywebsite.com?uid=12345.

Once the user clicks on the link and goes to your website, you can set his/or SkyGlue registered user Id to the existing user Id using JavaScript.

The following is the sample JavaScript code:

var userId=getParameterByName('uid');
var _sg_registeredUserId;
if(userId){
   _sg_registeredUserId = userId;
}

This is the sample function to get the query parameter value (many similar functions available online)

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

Please contact us if you have any questions with the above implementation.