Freshsales Java 라이브러리는 웹 애플리케이션을 사용하는 고객의 앱 내 활동을 추적하는 데 도움을 줍니다.
1단계: 시작하기
라이브러리를 설치하려면 다음을 수행해야 합니다,
- 최신 버전의 Freshsales Analytics jar (analytics-1.0.0.jar)을 다운로드합니다.
- com.freshsales.analytics.* 패키지는 분석 데이터를 전송하는 데 필요한 모든 핵심 클래스를 포함합니다. 이 패키지를 자바 클래스에 임포트하세요.
- 아래 코드 스니펫을 사용하여 핵심 분석 클래스인 FreshsalesAnalytics를 인스턴스화합니다.
FreshsalesAnalytics freshsales = new FreshsalesAnalytics("<APP URL>", "<APP TOKEN>");
4. "<APP URL>"과 "<APP TOKEN>"을 포털 URL과 앱 토큰으로 교체하세요. 이는 관리자 설정 > 통합 > 웹용 Freshsales > Java에서 찾을 수 있습니다.
2단계: 리드 생성
아래 스니펫을 사용하여 리드를 생성하고, 가입 및 로그인을 추적할 수 있습니다.
JSONObject newLead= new JSONObject();
newLead.put('Last name', 'John');
JSONObject company = new JSONObject();
company.put('name', 'Test Company');
newLead.put('company', company);
String identifier = 'john@abc.com';
freshsales.set(identifier, newLead);
3단계: 연락처 생성
아래 스니펫에서 freshsales.set를 사용하여 연락처를 생성하고, 가입 및 로그인을 추적할 수 있습니다.
JSONObject newLead= new JSONObject();
newLead.put('Last name', 'John');
newLead.put('fs_contact', true);
JSONObject company = new JSONObject();
company.put('name', 'Test Company');
newLead.put('company', company);
String identifier = 'john@abc.com';
freshsales.set(identifier, newLead);
4단계: 페이지뷰 추적
아래 스니펫에서 freshsales.trackPageView를 사용하여 애플리케이션에서 본 페이지를 추적할 수 있습니다.
String identifier = 'john@abc.com'; freshsales.trackPageView(identifier, 'http://sample.com/pricing');
5단계: 이벤트 추적
아래 스니펫을 사용하여 사용자 추가, 통합 활성화/비활성화, 비밀번호 재설정, 로그인 횟수 등과 같은 사용자의 앱 내 모든 활동을 Freshsales의 이벤트로 추적할 수 있습니다.
이벤트를 추적하려면,
-
알림을 받고자 하는 특정 콜 투 액션 버튼을 식별합니다.
-
아래 스니펫에서 trackEvent 메서드를 호출합니다.
String identifier = 'john@abc.com';
String eventName = 'Inviting new User';
JSONObject eventProperties = new JSONObject();
eventProperties.put('user_role', 'admin'); //이벤트 속성을 여기에 대체하세요
freshsales.trackEvent(identifier, eventName, eventProperties);
6단계: 리드 및 연락처 정보 업데이트
라이브러리는 웹 양식과 웹 앱에서의 방문자 활동을 통해 리드 및 연락처 정보를 업데이트합니다.
리드/연락처 정보를 업데이트하려면,
-
아래 스니펫에서 freshsales.set 을 호출합니다.
JSONObject contactPayment= new JSONObject();
contactPayment.put('Payment Id', 129863);
contactPayment.put('Plan Name', '2 agents');
contactPayment.put('Amount', '$2500')
contactPayment.put('CustomField', 'custom field value'); // 사용자 정의 필드로 대체하세요
String identifier = 'john@abc.com';
freshsales.set(identifier, contactPayment);
웹 양식에 Freshsales에 없는 필드가 있는 경우, 동일한 사용자 정의 필드를 생성하고 해당 값을 Freshsales로 전송할 수 있습니다.