Download script.js from ebaycom/tindertrack-e-commerce-clone: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/spaces/ebaycom/tindertrack-e-commerce-clone/resolve/main/script.js
- Command line
-
hf download hf://spaces/ebaycom/tindertrack-e-commerce-clone/script.js
-
curl -L -o script.js https://huggingface.co/spaces/ebaycom/tindertrack-e-commerce-clone/resolve/main/script.js
1.77 kB
| // Track all clicks on links with StoreID parameter | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Add click tracking to all links with StoreID | |
| const trackableLinks = document.querySelectorAll('a[href*="StoreID=tinder0001-20"]'); | |
| trackableLinks.forEach(link => { | |
| link.addEventListener('click', function(e) { | |
| // Simulate tracking - in a real app, this would send to analytics | |
| console.log(`Tracked click: ${this.getAttribute('href')}`); | |
| // Get product/category info from data attributes if available | |
| const productId = this.closest('[data-product-id]')?.getAttribute('data-product-id'); | |
| const category = this.closest('[data-category]')?.getAttribute('data-category'); | |
| // In a real implementation, you would send this data to your analytics platform | |
| const trackingData = { | |
| storeId: 'tinder0001-20', | |
| url: this.href, | |
| productId: productId || null, | |
| category: category || null, | |
| timestamp: new Date().toISOString() | |
| }; | |
| console.log('Tracking data:', trackingData); | |
| // For demo purposes, we'll store in localStorage | |
| const existingTracking = JSON.parse(localStorage.getItem('tinderTrackData') || '[]'); | |
| existingTracking.push(trackingData); | |
| localStorage.setItem('tinderTrackData', JSON.stringify(existingTracking)); | |
| }); | |
| }); | |
| // Initialize tooltips for rating stars | |
| const ratingStars = document.querySelectorAll('[data-feather="star"]'); | |
| ratingStars.forEach(star => { | |
| star.setAttribute('title', '5 Star Rating'); | |
| }); | |
| }); |