방문자 카운터 API 문서
우리 API는 무료로 웹사이트 방문자를 추적하고 방문자 통계를 검색할 수 있게 해줍니다. API 키 없음, 속도 제한 없음, 프리미엄 기능 없음 - 단지 간단하고 무료인 API입니다.
소개
방문자 카운터 API는 웹사이트 방문자를 추적하고 완전히 무료로 방문자 통계를 검색할 수 있게 해줍니다.
기본 URL
https://visitor.6developer.com
인증 - API 키 필요 없음
기본 사용에는 인증이 필요하지 않습니다. 도메인이 식별자로 사용됩니다. 우리 API는 사용 제한이 없습니다.
API 엔드포인트
방문 기록하기
POST
/visit
웹사이트 방문을 기록합니다.
요청 본문
{ "domain": "example.com", "timezone": "America/New_York", // Optional, defaults to UTC "page_path": "/blog/my-article", // Optional, the path of the current page "page_title": "My Article Title", // Optional, the title of the current page "referrer": "https://google.com", // Optional, the referrer URL "search_query": "my search query" // Optional, the search query if coming from a search engine }
응답
{ "dashboardUrl": "https://visitor.6developer.com/dashboard?domain=example.com", "totalCount": 42, "todayCount": 5 }
예시
fetch('https://visitor.6developer.com/visit', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ domain: 'example.com', timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, page_path: window.location.pathname, page_title: document.title, referrer: document.referrer }) }) .then(response => response.json()) .then(data => console.log(data));
방문 통계 가져오기
GET
/visit?domain=example.com
웹사이트의 방문자 통계를 검색합니다.
Query Parameters
domain: "example.com" // Required
응답
{ "dashboardUrl": "https://visitor.6developer.com/dashboard?domain=example.com", "totalCount": 42, "todayCount": 5 }
예시
fetch('https://visitor.6developer.com/visit?domain=example.com') .then(response => response.json()) .then(data => console.log(data));
통합
방문자 카운터를 웹사이트와 통합하려면 다음 스크립트를 HTML에 추가하세요:
<script> (function() { const domain = encodeURIComponent(window.location.hostname); const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; const page_path = window.location.pathname; const page_title = document.title; const referrer = document.referrer; // Extract search query if coming from a search engine let search_query = ''; if (referrer) { try { const url = new URL(referrer); if (url.hostname.includes('google.com')) { search_query = url.searchParams.get('q') || ''; } else if (url.hostname.includes('bing.com')) { search_query = url.searchParams.get('q') || ''; } else if (url.hostname.includes('yahoo.com')) { search_query = url.searchParams.get('p') || ''; } else if (url.hostname.includes('duckduckgo.com')) { search_query = url.searchParams.get('q') || ''; } } catch (e) { // Invalid URL, ignore } } fetch('https://visitor.6developer.com/visit', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ domain, timezone, page_path, page_title, referrer, search_query }) }) .then(response => response.json()) .then(data => { console.log('Visitor count:', data); // You can display the count on your page if (document.getElementById('visitor-count')) { document.getElementById('visitor-count').textContent = data.totalCount; } }) .catch(error => console.error('Error:', error)); })(); </script>
더 자세한 설치 지침은 다음을 참조하세요 설치 가이드.
NPM 패키지
더 쉬운 통합을 위해 NPM 패키지도 제공합니다:
npm install @rundevelrun/free-visitor-counter
NPM 패키지에 대한 자세한 정보는 다음을 방문하세요 GitHub 저장소.
오류 처리
API는 표준 HTTP 상태 코드를 반환합니다:
- 200 OK - 요청이 성공했습니다.
- 400 Bad Request - 요청이 유효하지 않습니다.
- 404 Not Found - 요청한 리소스를 찾을 수 없습니다.
- 500 Internal Server Error - 서버에서 오류가 발생했습니다.
오류 응답 형식
{ "error": "Error message description" }
속도 제한 - 관대한 제한
API는 IP 주소당 분당 100개의 요청으로 제한되어 있으며, 이는 대부분의 웹사이트에 충분합니다.
이 제한을 초과하면 429 Too Many Requests 응답을 받게 됩니다.
CORS 정책
우리 API는 모든 도메인에서의 교차 출처 요청을 허용합니다.
시작할 준비가 되셨나요?
오늘부터 웹사이트 방문자를 추적해보세요.