Improve video view tracking by using a shortened identifier

Update the video view tracking API calls to use a truncated version of the video ID (first 8 characters after removing hyphens) in `bunny-video-modal.tsx`, `video-modal.tsx`, and `VideoPage.tsx`.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/gueMD9C
This commit is contained in:
sebastjanartic 2025-09-03 12:12:05 +00:00
parent a6accad407
commit 1e50f5ba67
3 changed files with 9 additions and 3 deletions

View File

@ -102,7 +102,9 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos
const handleVideoPlay = async () => {
if (video) {
try {
await apiRequest("POST", `/api/videos/${video.id}/view`);
// Use short ID for view tracking
const shortId = video.id.replace(/-/g, '').substring(0, 8);
await apiRequest("POST", `/api/videos/${shortId}/view`);
} catch (error) {
console.error("Failed to track video view:", error);
}

View File

@ -315,7 +315,9 @@ export default function VideoModal({ video, isOpen, onClose, enableAds = true }:
const handleVideoPlay = async () => {
if (video) {
try {
await apiRequest("POST", `/api/videos/${video.id}/view`);
// Use short ID for view tracking
const shortId = video.id.replace(/-/g, '').substring(0, 8);
await apiRequest("POST", `/api/videos/${shortId}/view`);
} catch (error) {
console.error("Failed to track video view:", error);
}

View File

@ -261,7 +261,9 @@ export default function VideoPage() {
const handleVideoPlay = async () => {
if (currentVideo) {
try {
await apiRequest("POST", `/api/videos/${currentVideo.id}/view`);
// Use short ID for view tracking
const shortId = currentVideo.id.replace(/-/g, '').substring(0, 8);
await apiRequest("POST", `/api/videos/${shortId}/view`);
} catch (error) {
console.error("Failed to track video view:", error);
}