fertiges design

This commit is contained in:
2025-08-28 13:48:46 +02:00
parent c66a0e49f3
commit d31681cee1
50 changed files with 7516 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
// Analytics configuration for Google Analytics and Google Tag Manager
// Replace with your actual tracking IDs
export const analyticsConfig = {
// Google Analytics 4 Measurement ID
ga4Id: 'G-XXXXXXXXXX', // Replace with your GA4 ID
// Google Tag Manager Container ID
gtmId: 'GTM-XXXXXXX', // Replace with your GTM ID
// Google Analytics Universal Analytics (legacy)
uaId: 'UA-XXXXXXXXX-X', // Replace with your UA ID if needed
// Custom dimensions and metrics
customDimensions: {
userType: 'cd1',
pageType: 'cd2',
contentCategory: 'cd3'
},
// Enhanced ecommerce settings
ecommerce: {
enabled: false, // Set to true if you have ecommerce
currency: 'USD'
},
// Privacy settings
privacy: {
anonymizeIp: true,
respectDoNotTrack: true,
cookieConsent: true
}
}
// Initialize Google Analytics
export const initGA = () => {
if (typeof window !== 'undefined' && window.gtag) {
// GA4 is already loaded
return
}
// Load Google Analytics script
const script = document.createElement('script')
script.async = true
script.src = `https://www.googletagmanager.com/gtag/js?id=${analyticsConfig.ga4Id}`
document.head.appendChild(script)
// Initialize gtag
window.dataLayer = window.dataLayer || []
window.gtag = function() {
window.dataLayer.push(arguments)
}
window.gtag('js', new Date())
window.gtag('config', analyticsConfig.ga4Id, {
anonymize_ip: analyticsConfig.privacy.anonymizeIp,
page_title: document.title,
page_location: window.location.href
})
}
// Initialize Google Tag Manager
export const initGTM = () => {
if (typeof window !== 'undefined' && window.dataLayer) {
// GTM is already loaded
return
}
// Load GTM script
const script = document.createElement('script')
script.innerHTML = `
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','${analyticsConfig.gtmId}');
`
document.head.appendChild(script)
// Add GTM noscript fallback
const noscript = document.createElement('noscript')
noscript.innerHTML = `
<iframe src="https://www.googletagmanager.com/ns.html?id=${analyticsConfig.gtmId}"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
`
document.body.insertBefore(noscript, document.body.firstChild)
}
// Enhanced event tracking
export const trackEvent = (eventName, parameters = {}) => {
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', eventName, {
...parameters,
custom_map: analyticsConfig.customDimensions
})
}
}
// Page view tracking
export const trackPageView = (pageTitle, pageLocation) => {
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('config', analyticsConfig.ga4Id, {
page_title: pageTitle,
page_location: pageLocation || window.location.href
})
}
}
// Conversion tracking
export const trackConversion = (conversionId, conversionLabel) => {
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'conversion', {
send_to: `AW-${conversionId}/${conversionLabel}`
})
}
}

44
src/utils/analytics.js Normal file
View File

@@ -0,0 +1,44 @@
export const track = (eventName, params = {}) => {
if (window && window.gtag) {
window.gtag('event', eventName, params)
} else {
console.log('[analytics]', eventName, params)
}
}
// DataLayer tracking for GA4/GTM
export const DL = (...args) => {
if (window && window.dataLayer) {
window.dataLayer.push(...args)
}
}
export const events = {
CTA_CLICK: 'cta_click',
CLICK_TO_CALL: 'click_to_call',
OPEN_DIRECTIONS: 'open_directions',
FORM_START: 'form_start',
FORM_SUBMIT: 'form_submit',
NEWSLETTER_SIGNUP: 'newsletter_signup',
EVENT_DETAILS_VIEW: 'event_details_view',
SERMON_PLAY: 'sermon_play'
}
// Initialize analytics event listeners
export const initAnalytics = () => {
// CTA tracking
document.querySelectorAll('[data-cta]').forEach(el => {
el.addEventListener('click', () => {
DL({ event: 'cta_click', label: el.dataset.cta })
})
})
// Form tracking
const visitForm = document.getElementById('visit-form')
if (visitForm) {
visitForm.addEventListener('focusin', () => {
DL({ event: 'form_start', form_id: 'visit_home' })
}, { once: true })
}
}

90
src/utils/email.js Normal file
View File

@@ -0,0 +1,90 @@
// Email service utility for form submissions
// This is a placeholder implementation - replace with your actual email service
export const sendVisitRequest = async (formData) => {
try {
// Simulate API call - replace with actual email service
console.log('Sending visit request:', formData)
// Example integration with services like:
// - EmailJS
// - SendGrid
// - AWS SES
// - Netlify Forms
// - Vercel Functions
// For now, simulate a successful response
await new Promise(resolve => setTimeout(resolve, 1000))
return {
success: true,
message: 'Visit request sent successfully'
}
} catch (error) {
console.error('Error sending visit request:', error)
return {
success: false,
message: 'Failed to send visit request. Please try again.'
}
}
}
export const sendContactForm = async (formData) => {
try {
console.log('Sending contact form:', formData)
// Simulate API call
await new Promise(resolve => setTimeout(resolve, 1000))
return {
success: true,
message: 'Message sent successfully'
}
} catch (error) {
console.error('Error sending contact form:', error)
return {
success: false,
message: 'Failed to send message. Please try again.'
}
}
}
// Email templates
export const emailTemplates = {
visitRequest: (data) => ({
subject: 'New Visit Request - Annaville SDA Church',
body: `
New visit request received:
Name: ${data.name}
Email: ${data.email}
Visit Date: ${data.date || 'Not specified'}
Message: ${data.message}
Consent: ${data.consent ? 'Yes' : 'No'}
Please respond to this request within 24 hours.
`
}),
autoReply: (data) => ({
subject: 'Thank you for your visit request - Annaville SDA Church',
body: `
Dear ${data.name},
Thank you for your interest in visiting Annaville Seventh-day Adventist Church!
We've received your visit request and will be in touch soon with directions and parking information.
Service Times:
- Sabbath School: 9:30 AM
- Worship Service: 11:00 AM
Location: 2710 Violet Rd, Corpus Christi, TX 78410
We look forward to meeting you!
Blessings,
Annaville SDA Church Team
`
})
}