플레이어를 실행할 때 로그인한 사용자의 아이디와 이름을 직접 입력하는 방식입니다. 고객사 서버에서 JWT를 적용하기 어려운 경우나 빠르게 플레이어를 연동할 경우 이용합니다.
Property name  | Description  | Sample  | Comment  | 
|---|
userId (필수)  | 사용자 아이디  | sample_user_id  | 로그인 사용자의 유일성을 보장할 수 있는 값  | 
userName  | 사용자 이름 (채팅창에서 사용)  | 닉네임  | 이름을 지정하지 않을 경우 캠페인의 채팅 설정에 따라 채팅시 입력을 강제하도록 하거나 임의로 생성되도록 할 수 있습니다.  | 
gender  | 사용자 성별  | 빈 값(미지정), m(남), f(여)  | 전체/로그인 시청자 데이터에서 확인할 수 있습니다.  | 
age  | 사용자 나이  | 25  | 전체/로그인 시청자 데이터에서 확인할 수 있습니다.  | 
custom  | 사용자 임의 데이터  | custom data  | 최대 1KB까지 임의의 데이터를 세팅할 수 있습니다. 전체/로그인 시청자 데이터에서 확인할 수 있습니다.  | 
userScore  | 사용자 등급  | 10  | 사용자 등급을 세팅하면 등급에 따른 입장 제한, 이벤트 추첨 제한 등의 기준으로 사용할 수 있습니다. -100에서 100까지의 정수로 세팅할 수 있습니다.  | 
userType  | 사용자 유형  | VIP  | 방송 입장 제한(Entry Type)이 설정된 방송에 입장할 때, 해당 값을 참조하여 특정 유저(VIP)만 방송에 입장하도록 설정할 수 있습니다.  | 
profile  | 사용자 프로필 이미지 URL  | https://image.shoplive.cloud/sample_profile.png  | 방송의 채팅 목록에서 프로필 이미지를 표시할 때 이미지 경로를 직접 설정할 수 있습니다. 권장되는 이미지 크기는 64px X 64px입니다. 이미지 파일 크기를 과도하게 증가시키지 않도록 주의하십시오.  | 
아래의 샘플 코드를 참고하시기 바랍니다.
<script type="text/javascript" src="https://static.shoplive.cloud/shoplive.js"></script>
<script>
  const userObject = {
    userId: "{userID_here}", // required
    userName: "{userName_here}", // optional
    gender: "m", // optional
    age: 25, // optional
    custom: "custom data", // optional
    userScore: 10, // optional
    userType: "VIP", // optional
    profile: "https://image.shoplive.cloud/sample_profile.png" // optional
  };
  // init과 함께 전달하는 방식
  cloud.shoplive.init({
    accessKey: 'YOUR ACCESS KEY HERE',
    userObject: userObject
  });
</script>
<!-- OR -->
<script type="text/javascript" src="https://static.shoplive.cloud/shoplive.js"></script>
<script>
  const userObject = {
    userId: "{userID_here}", // required
    userName: "{userName_here}", // optional
    gender: "m", // optional
    age: 25, // optional
    custom: "custom data", // optional
    userScore: 10, // optional
    userType: "VIP", // optional
    profile: "https://image.shoplive.cloud/sample_profile.png" // optional
  };
  cloud.shoplive.init({ accessKey: 'YOUR ACCESS KEY HERE' });
  
  // setUserObject()를 통해 전달하는 방식
  cloud.shoplive.setUserObject(userObject);
</script>