- brickfieldsfarmhol
- Dec 27, 2021
- 1 min read
Meet Cooper one of our furry team members. You're likely to spot him in the undergrowth waiting to pounce on an unsuspecting ankle. We love him though.

const META_PIXEL_ID = '660154033083965'; (function (f, b, e, v, n, t, s) { if (typeof window === 'undefined' || typeof document === 'undefined') return; if (f.fbq) return; n = f.fbq = function () { n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments); }; if (!f._fbq) f._fbq = n; n.push = n; n.loaded = true; n.version = '2.0'; n.queue = []; t = b.createElement(e); t.async = true; t.src = v; s = b.getElementsByTagName(e)[0]; if (s && s.parentNode) { s.parentNode.insertBefore(t, s); } })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); let pixelInitialized = false; let initializedWithAdvancedMatching = false; function toNumber(value) { const n = parseFloat(value); return Number.isFinite(n) ? n : undefined; } function normalizeId(id) { if (id == null) return undefined; return String(id); } function getPageData() { if (typeof window === 'undefined') return {}; return { event_source_url: window.location.href, }; } function cleanObject(obj) { return Object.fromEntries( Object.entries(obj).filter(([, value]) => value !== undefined) ); } function ensurePixelInit(advancedMatching = {}) { if (typeof window === 'undefined' || typeof fbq === 'undefined') return; const hasAdvancedMatching = Object.keys(advancedMatching).length > 0; if (!pixelInitialized) { fbq('init', META_PIXEL_ID, hasAdvancedMatching ? advancedMatching : {}); pixelInitialized = true; initializedWithAdvancedMatching = hasAdvancedMatching; return; } if (hasAdvancedMatching && !initializedWithAdvancedMatching) { fbq('init', META_PIXEL_ID, advancedMatching); initializedWithAdvancedMatching = true; } } function buildAdvancedMatching(data = {}) { const advanced = {}; if (data.email) advanced.em = data.email; if (data.phone) advanced.ph = data.phone; if (data.firstName) advanced.fn = data.firstName; if (data.lastName) advanced.ln = data.lastName; if (data.city) advanced.ct = data.city; if (data.state) advanced.st = data.state; if (data.zip) advanced.zp = data.zip; if (data.country) advanced.country = data.country; return advanced; } export function trackPageView() { ensurePixelInit(); fbq('track', 'PageView', cleanObject({ ...getPageData(), })); } export function trackViewContent(product = {}) { ensurePixelInit(); const contentId = normalizeId(product.variantId) || normalizeId(product.productId) || normalizeId(product.id); const payload = cleanObject({ ...getPageData(), content_ids: contentId ? [contentId] : undefined, contents: contentId ? [{ id: contentId, quantity: 1 }] : undefined, content_type: 'product', content_name: product.name || product.title, value: toNumber(product.price), currency: product.currency, }); fbq('track', 'ViewContent', payload); } export function trackAddToCart(item = {}) { ensurePixelInit(); const contentId = normalizeId(item.variantId) || normalizeId(item.productId) || normalizeId(item.id); const quantity = item.quantity || 1; const payload = cleanObject({ ...getPageData(), content_ids: contentId ? [contentId] : undefined, contents: contentId ? [{ id: contentId, quantity }] : undefined, content_type: 'product', content_name: item.name || item.title, value: toNumber(item.price), currency: item.currency, }); fbq('track', 'AddToCart', payload); } export function trackInitiateCheckout(checkout = {}) { ensurePixelInit(); const lineItems = Array.isArray(checkout.lineItems) ? checkout.lineItems : []; const contents = lineItems .map((item) => { const id = normalizeId(item.variantId) || normalizeId(item.productId) || normalizeId(item.id); return cleanObject({ id, quantity: item.quantity || 1, item_price: toNumber(item.price), }); }) .filter((item) => item.id); const contentIds = contents.map((item) => item.id); const numItems = lineItems.reduce((sum, item) => sum + (item.quantity || 0), 0); const payload = cleanObject({ ...getPageData(), content_ids: contentIds, contents, content_type: 'product', value: toNumber(checkout.value || checkout.total), currency: checkout.currency, num_items: numItems, }); fbq('track', 'InitiateCheckout', payload); } export function trackPurchase(order = {}, customer = {}) { const advancedMatching = buildAdvancedMatching(customer); ensurePixelInit(advancedMatching); const lineItems = Array.isArray(order.lineItems) ? order.lineItems : []; const contents = lineItems .map((item) => { const id = normalizeId(item.variantId) || normalizeId(item.productId) || normalizeId(item.id); return cleanObject({ id, quantity: item.quantity || 1, item_price: toNumber(item.price), }); }) .filter((item) => item.id); const contentIds = contents.map((item) => item.id); const numItems = lineItems.reduce((sum, item) => sum + (item.quantity || 0), 0); const payload = cleanObject({ ...getPageData(), content_ids: contentIds, contents, content_type: 'product', value: toNumber(order.value || order.total), currency: order.currency, num_items: numItems, order_id: normalizeId(order.orderId || order.id || order.number), }); fbq('track', 'Purchase', payload); }
.png)
Kirby Mills Kirkbymoorside North Yorkshire YO62 6NS
Call 01751 433074 Email: brickfieldsfarmholidays@gmail.com
