File size: 1,848 Bytes
67c7f5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd2970b
 
 
 
 
 
 
 
 
 
 
67c7f5f
fd2970b
 
67c7f5f
fd2970b
 
 
 
67c7f5f
 
 
fd2970b
 
67c7f5f
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function (e) {
        e.preventDefault();
        document.querySelector(this.getAttribute('href')).scrollIntoView({
            behavior: 'smooth'
        });
    });
});

// Facebook SDK integration
window.fbAsyncInit = function() {
    FB.init({
        appId            : 'your-app-id',
        autoLogAppEvents : true,
        xfbml            : true,
        version          : 'v12.0'
    });
};

// Load Facebook SDK
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/fr_FR/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Product tracking
document.querySelectorAll('[data-product]').forEach(btn => {
    btn.addEventListener('click', function() {
        const productName = this.getAttribute('data-product');
        gtag('event', 'product_click', {
            'product_name': productName,
            'currency': 'XOF',
            'value': this.getAttribute('data-price')
        });
    });
});

// WhatsApp CTA tracking
document.querySelectorAll('.whatsapp-cta').forEach(btn => {
    btn.addEventListener('click', function() {
        gtag('event', 'whatsapp_click', {
            'event_category': 'CTA',
            'event_label': this.getAttribute('data-cta-type')
        });
    });
});

// Facebook pixel tracking
fbq('track', 'PageView');
// Form submission handling
document.getElementById('contactForm')?.addEventListener('submit', function(e) {
    e.preventDefault();
    // Handle form submission here
    alert('Merci pour votre message! Nous vous contacterons bientôt.');
    this.reset();
});