Freshsales 자바스크립트 라이브러리는 웹사이트의 방문자를 리드(또는 연락처)로 식별하고, 그들의 활동을 실시간으로 추적하며, 과거 활동과 방문한 페이지의 기록을 제공합니다.
STEP 1 : 시작하기
- 관리자 설정 > 통합 > 웹용 Freshsales > 자바스크립트에서 스니펫을 복사합니다. 이 스니펫은 freshsales_portal_url과 authentication_token으로 미리 채워져 있습니다.
- 또는, 아래 스니펫에서 freshsales_portal_url과 authentication_token을 Freshsales 포털의 URL과 인증 토큰으로 교체하고 복사합니다.
<script> function createTempFunction(function_name) { (window.freshsales)[function_name]=function() { (window.freshsales).push([function_name].concat(Array.prototype.slice.call(arguments,0))) }; } (function(url, app_token) { window.assets_url='//d952cmcgwqsjf.cloudfront.net'; window.freshsales = window.freshsales || []; functions_list='init identify trackPageView trackEvent set'.split(' '); for(var i=0; i < functions_list.length; i++) { var function_name = functions_list[i]; createTempFunction(function_name); } var script_tag = document.createElement('script'); script_tag.async=1; script_tag.src= window.assets_url +'/assets/analytics.js'; var first_script_tag = document.getElementsByTagName('script')[0]; first_script_tag.parentNode.insertBefore(script_tag,first_script_tag); freshsales.init(url, app_token); })('freshsales_portal_url','authentication_token'); </script>
3. 라이브러리를 웹사이트의 HTML 헤더에 붙여넣습니다.
STEP 2: 리드 생성
Freshsales는 웹사이트 방문자가 웹 양식(가입, 웨비나 등록 양식)에 이메일 주소를 제출할 때 리드를 생성합니다. 아래 스니펫에서,
- 요소 ID를 웹 양식의 실제 필드 ID로 교체합니다.
- 웹 양식 제출 및 검증 후, identify 메서드를 호출합니다.
var identifier = $("#email").val(),
lead_properties = {
"First name" : $("#first_name").val(),
"Last name" : $("#last_name").val(),
"Date Of Birth" : $("#dob").val(), //Date of Birth is created as Lead custom field
"company" : {
"Name" : $("#company_name").val(),
"Website" : $("#compan_website").val()
}
};
freshsales.identify(identifier, lead_properties);
3. 웹 양식에 Freshsales에 없는 필드가 있는 경우, 사용자 정의 필드를 생성하여 값을 Freshsales로 전송할 수 있습니다.
"Date Of Birth"는 날짜 선택기 유형의 사용자 정의 필드로 생성됩니다.
STEP 3: 연락처 생성
fs_contact를 사용하여 웹사이트 방문자를 연락처로 캡처하려면,
- 요소 ID를 웹 양식의 실제 필드 ID로 교체합니다.
- 웹 양식 제출 및 검증 후, identify 메서드를 호출합니다.
var identifier = $("#email").val(),
contact_properties = {
"fs_contact" : true,
"First name" : $("#first_name").val(),
"Last name" : $("#last_name").val(),
"Date Of Birth" : $("#dob").val(),
"company" : {
"Name" : $("#company_name").val(),
"Website" : $("#compan_website").val()
}
};
freshsales.identify(identifier, contact_properties);
|
참고:
|
STEP 4: 페이지뷰 추적
웹사이트의 HTML 헤더에 붙여넣은 Freshsales 라이브러리는 모든 웹 페이지에 포함되어 라이브러리가 초기화되면 페이지를 추적합니다.
그러나, 단일 페이지 애플리케이션인 경우, 각 페이지에서
freshsales.trackPageView(“<URL of the Page>”);
를 호출하여 페이지뷰를 추적해야 합니다.
STEP 5: 이벤트 추적
웹사이트에서 백서 다운로드, 소셜 프로필의 팔로우 버튼 클릭과 같은 방문자 활동을 Freshsales에서 이벤트로 추적합니다.
이벤트를 추적하려면,
-
알림을 받고 싶은 특정 행동 유도 버튼을 식별합니다.
-
아래 스니펫에서 trackEvent 메서드를 호출합니다.
var sample_event_properties = {
'title': 'How to win more sales' // Replace with title of the whitepaper
};
freshsales.trackEvent('Downloaded White paper', sample_event_properties);
STEP 6: 리드 및 연락처 정보 업데이트
라이브러리는 웹 양식과 웹사이트 및 웹앱의 방문자 활동을 통해 리드 및 연락처 정보를 업데이트합니다.
리드/연락처 정보를 업데이트하려면,
-
아래 스니펫에서 set 메서드를 호출합니다.
var sample_properties = {
'Address': '8691 MacGyver Mews', // Replace with address of user
'City': 'New Jermaine', // Replace with city of user
'Mobile': '13457879', // Replace with mobile number of user
'Custom Field': 'custom field value' // Replace with a custom field
};
freshsales.set(sample_properties);
- 양식이 제출되거나 작업이 수행될 때마다 해당 사용자의 이메일 주소가 Freshsales에서 일치하는 항목을 검색합니다.
- 검색은 리드 목록에서 시작하며, 일치하는 항목이 없으면 연락처 목록을 검색합니다.
- 그러나 리드 목록에서 일치하는 항목이 발견되면 데이터가 해당 리드의 기록에 연결됩니다.
- 연락처에서 일치하는 항목이 발견되면 웹 양식에 제출된 모든 세부 정보가 해당 연락처의 기록에 채워집니다.
- 여러 항목이 일치하는 경우, 데이터는 가장 최근 활동이 있는 기록에 연결됩니다.