File size: 1,772 Bytes
ea5e784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 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');
    });
});