Skip to main content

Marketing Integrations

Blocker Outdoors integrates with multiple marketing platforms to track customer behavior, manage email campaigns, display product reviews, and offer flexible payment options.

Integration Overview

PlatformPurposeVersion
KlaviyoEmail marketing & automationREST API v2
BazaarVoiceProduct reviews & ratingsPIE v1.0
Google Tag ManagerAnalytics & conversion trackingGTM4WP v1.20.3
KlarnaBuy now, pay later financingOn-Site Messaging v2
SezzleInstallment payment plansWidget v3.0

Klaviyo Email Marketing

Email marketing platform with product tracking, segmentation, and automated flows.

Configuration

// wp-config.php
define( 'KLAVIYO_API_KEY', 'pk_xxxxxxxxxxxxxxxxxxxxx' ); // Public API key
define( 'KLAVIYO_PRIVATE_KEY', 'xxxxxxxxxxxxxxxxxxxxx' ); // Private API key
define( 'KLAVIYO_COMPANY_ID', 'ABC123' ); // Company ID from account settings

JavaScript Tracking

Klaviyo snippet in header:

<!-- Klaviyo Tracking -->
<script async type="text/javascript" src="https://static.klaviyo.com/onsite/js/klaviyo.js?company_id=<?php echo KLAVIYO_COMPANY_ID; ?>"></script>
<script>
var _learnq = _learnq || [];
_learnq.push(['account', '<?php echo KLAVIYO_COMPANY_ID; ?>']);
</script>

Event Tracking

Product Viewed Event

// Triggered on product page load
_learnq.push(['track', 'Viewed Product', {
'ProductName': 'Scent Blocker Jacket',
'ProductID': 'BC123456',
'SKU': 'BL-JACKET-001',
'Categories': ['Jackets', 'Hunting Apparel'],
'ImageURL': 'https://blockeroutdoors.com/wp-content/uploads/jacket.jpg',
'URL': 'https://blockeroutdoors.com/product/scent-blocker-jacket',
'Brand': 'Blocker Outdoors',
'Price': 149.99,
'CompareAtPrice': 179.99,
}]);

Added to Cart Event

// Triggered on add-to-cart button click
_learnq.push(['track', 'Added to Cart', {
'$value': 149.99,
'AddedItemProductName': 'Scent Blocker Jacket',
'AddedItemProductID': 'BC123456',
'AddedItemSKU': 'BL-JACKET-001-LG-RTE',
'AddedItemCategories': ['Jackets', 'Hunting Apparel'],
'AddedItemImageURL': 'https://blockeroutdoors.com/wp-content/uploads/jacket.jpg',
'AddedItemURL': 'https://blockeroutdoors.com/product/scent-blocker-jacket',
'AddedItemPrice': 149.99,
'AddedItemQuantity': 1,
'ItemNames': ['Scent Blocker Jacket'], // All cart items
'CheckoutURL': 'https://blockeroutdoors.com/checkout/abc123',
'Items': [
{
'ProductID': 'BC123456',
'SKU': 'BL-JACKET-001-LG-RTE',
'ProductName': 'Scent Blocker Jacket',
'Quantity': 1,
'ItemPrice': 149.99,
'RowTotal': 149.99,
'ProductURL': 'https://blockeroutdoors.com/product/scent-blocker-jacket',
'ImageURL': 'https://blockeroutdoors.com/wp-content/uploads/jacket.jpg',
},
],
}]);

Started Checkout Event

// Triggered when user begins checkout
_learnq.push(['track', 'Started Checkout', {
'$event_id': 'cart_abc123_' + Date.now(),
'$value': 149.99,
'ItemNames': ['Scent Blocker Jacket'],
'CheckoutURL': 'https://blockeroutdoors.com/checkout/abc123',
'Categories': ['Jackets', 'Hunting Apparel'],
'Items': [
{
'ProductID': 'BC123456',
'SKU': 'BL-JACKET-001-LG-RTE',
'ProductName': 'Scent Blocker Jacket',
'Quantity': 1,
'ItemPrice': 149.99,
'RowTotal': 149.99,
'ProductURL': 'https://blockeroutdoors.com/product/scent-blocker-jacket',
'ImageURL': 'https://blockeroutdoors.com/wp-content/uploads/jacket.jpg',
},
],
}]);

Placed Order Event (Server-Side)

/**
* Track order placement via Klaviyo API
* Triggered by BigCommerce order webhook
*/
function klaviyo_track_order_placed( $order_data ) {

$customer_email = $order_data['billing_address']['email'];
$order_id = $order_data['id'];
$order_total = $order_data['total_inc_tax'];

$event_data = [
'token' => KLAVIYO_API_KEY,
'event' => 'Placed Order',
'customer_properties' => [
'$email' => $customer_email,
'$first_name' => $order_data['billing_address']['first_name'],
'$last_name' => $order_data['billing_address']['last_name'],
'$phone_number' => $order_data['billing_address']['phone'],
'$city' => $order_data['billing_address']['city'],
'$region' => $order_data['billing_address']['state'],
'$zip' => $order_data['billing_address']['zip'],
'$country' => $order_data['billing_address']['country'],
],
'properties' => [
'$event_id' => 'order_' . $order_id,
'$value' => $order_total,
'OrderId' => (string) $order_id,
'Categories' => [],
'ItemNames' => [],
'Items' => [],
],
];

// Add line items
foreach ( $order_data['products'] as $product ) {
$event_data['properties']['Items'][] = [
'ProductID' => (string) $product['product_id'],
'SKU' => $product['sku'],
'ProductName' => $product['name'],
'Quantity' => $product['quantity'],
'ItemPrice' => $product['price_inc_tax'],
'RowTotal' => $product['total_inc_tax'],
'ProductURL' => get_product_url_by_bc_id( $product['product_id'] ),
'ImageURL' => get_product_image_by_bc_id( $product['product_id'] ),
];

$event_data['properties']['ItemNames'][] = $product['name'];
}

// Send to Klaviyo Track API
$response = wp_remote_get(
'https://a.klaviyo.com/api/track?' . http_build_query( [
'data' => base64_encode( json_encode( $event_data ) ),
] )
);

if ( is_wp_error( $response ) ) {
error_log( 'Klaviyo API Error: ' . $response->get_error_message() );
}
}

// Hook into BigCommerce order webhook
add_action( 'bigcommerce_order_created', 'klaviyo_track_order_placed' );

Profile Identification

// Identify user (on login or account creation)
_learnq.push(['identify', {
'$email': '[email protected]',
'$first_name': 'John',
'$last_name': 'Doe',
'$phone_number': '+1234567890',
'$city': 'Denver',
'$region': 'Colorado',
'$zip': '80202',
'$country': 'United States',
'Customer Type': 'Retail',
'Lifetime Value': 450.00,
}]);

Email Subscription Forms

// Klaviyo newsletter signup form
function render_klaviyo_newsletter_form() {
?>
<form id="klaviyo-newsletter-form" class="klaviyo-form">
<input
type="email"
name="email"
placeholder="Enter your email"
required
class="form-input"
/>
<button type="submit" class="btn btn-primary">
Subscribe
</button>
</form>

<script>
document.getElementById('klaviyo-newsletter-form').addEventListener('submit', function(e) {
e.preventDefault();

const email = this.email.value;

// Identify subscriber
_learnq.push(['identify', {
'$email': email,
'$consent': ['email'],
'Newsletter Signup Source': 'Footer',
}]);

// Track subscription
_learnq.push(['track', 'Subscribed to Newsletter', {
'$email': email,
'Source': 'Footer',
}]);

// Show success message
alert('Thank you for subscribing!');
this.reset();
});
</script>
<?php
}

Klaviyo Flows

Recommended automated email flows:

  1. Welcome Series

    • Trigger: Subscribed to Newsletter
    • 3-email series introducing brand and products
  2. Abandoned Cart

    • Trigger: Started Checkout (without order)
    • 3 emails at 1 hour, 24 hours, 48 hours
    • Include cart items and checkout link
  3. Browse Abandonment

    • Trigger: Viewed Product (without add-to-cart)
    • 1 email at 24 hours with product recommendations
  4. Post-Purchase

    • Trigger: Placed Order
    • Thank you email + cross-sell recommendations
  5. Back in Stock

    • Trigger: Product inventory update
    • Email customers who requested notification
  6. Win-Back

    • Trigger: No purchase in 90 days
    • Offer discount code to re-engage

BazaarVoice Product Reviews

Product reviews and ratings platform with schema.org markup.

Configuration

// BazaarVoice settings
define( 'BAZAARVOICE_CLIENT_NAME', 'blockeroutdoors' );
define( 'BAZAARVOICE_SITE_ID', 'main_site' );
define( 'BAZAARVOICE_ENVIRONMENT', 'production' ); // or 'staging'
define( 'BAZAARVOICE_LOCALE', 'en_US' );

JavaScript Integration

<!-- BazaarVoice Loader -->
<script>
$BV.configure('global', {
productId: '<?php echo $bc_product_id; ?>',
});

// Load BazaarVoice libraries
$BV.ui('rr', 'show_reviews', {
productId: '<?php echo $bc_product_id; ?>',
});
</script>

Review Display

Inline Ratings (Product Card)

<!-- Average rating stars on product card -->
<div id="BVRRInlineRating-<?php echo $bc_product_id; ?>"></div>

<script>
$BV.ui('rr', 'inline_ratings', {
productId: '<?php echo $bc_product_id; ?>',
containerPrefix: 'BVRRInlineRating',
});
</script>

Full Reviews Display

<!-- Full reviews section on product page -->
<div id="BVRRContainer" class="product-reviews mt-12">
<h2 class="text-2xl font-heading font-bold mb-6">Customer Reviews</h2>
<div id="BVRRSummaryContainer"></div>
<div id="BVRRDisplayContainer"></div>
</div>

<script>
$BV.ui('rr', 'show_reviews', {
productId: '<?php echo $bc_product_id; ?>',
summaryContainerDiv: 'BVRRSummaryContainer',
reviewsContainerDiv: 'BVRRDisplayContainer',
});
</script>

Schema.org Markup

/**
* Output structured data for product reviews
*/
function output_bazaarvoice_schema( $product_id ) {
$bc_id = get_post_meta( $product_id, 'bigcommerce_id', true );

// Fetch review stats from BazaarVoice API or cache
$review_stats = get_bazaarvoice_stats( $bc_id );

if ( ! $review_stats || $review_stats['TotalReviewCount'] === 0 ) {
return;
}

$schema = [
'@context' => 'https://schema.org/',
'@type' => 'Product',
'name' => get_the_title( $product_id ),
'sku' => get_post_meta( $product_id, 'bigcommerce_sku', true ),
'aggregateRating' => [
'@type' => 'AggregateRating',
'ratingValue' => $review_stats['AverageOverallRating'],
'reviewCount' => $review_stats['TotalReviewCount'],
'bestRating' => 5,
'worstRating' => 1,
],
];

?>
<script type="application/ld+json">
<?php echo json_encode( $schema, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ); ?>
</script>
<?php
}

add_action( 'wp_head', function() {
if ( is_singular( 'bigcommerce_product' ) ) {
output_bazaarvoice_schema( get_the_ID() );
}
} );

Google Tag Manager (GTM4WP v1.20.3)

Centralized tag management for analytics, conversion tracking, and remarketing.

Installation

wp plugin install duracelltomi-google-tag-manager-v1.20.3.zip --activate

Configuration

Settings → Google Tag Manager:

GTM Container ID: GTM-XXXXXXX
Include in <head>: Yes
Data Layer Events: Enable all e-commerce events
Track Login/Logout: Yes
Track Searches: Yes
Track Forms: Yes

Enhanced E-Commerce Tracking

GTM4WP automatically pushes these events to the data layer:

  1. Product Impressions (product list pages)
  2. Product Clicks (click to product page)
  3. Product Detail Views (product page)
  4. Add to Cart (add button click)
  5. Remove from Cart (cart updates)
  6. Checkout Steps (checkout progress)
  7. Purchases (order confirmation)

Custom Data Layer Variables

// Custom dimension: Customer Type
window.dataLayer.push({
'customerType': 'Retail', // or 'Dealer'
'customerLifetimeValue': 450.00,
});

GTM Container Setup

Tags:

  1. Google Analytics 4 Configuration

    • Tag Type: Google Analytics: GA4 Configuration
    • Measurement ID: G-XXXXXXXXXX
    • Trigger: All Pages
  2. GA4 Purchase Event

    • Tag Type: Google Analytics: GA4 Event
    • Event Name: purchase
    • Trigger: Purchase (data layer)
  3. Facebook Pixel Base Code

    • Tag Type: Custom HTML
    • Trigger: All Pages
  4. Facebook Pixel AddToCart Event

    • Tag Type: Custom HTML
    • Trigger: Add to Cart (data layer)

Klarna Financing

Buy now, pay later financing with on-site messaging.

Configuration

// Klarna settings
define( 'KLARNA_CLIENT_ID', 'xxxxxxxxxxxxx' );
define( 'KLARNA_REGION', 'US' ); // US, EU, OC
define( 'KLARNA_ENVIRONMENT', 'production' ); // or 'playground'

On-Site Messaging

<!-- Product page messaging -->
<klarna-placement
data-key="credit-promotion-auto-size"
data-locale="en-US"
data-purchase-amount="<?php echo intval( $price * 100 ); ?>"
></klarna-placement>

<script src="https://js.klarna.com/web-sdk/v1/klarna.js"
data-client-id="<?php echo KLARNA_CLIENT_ID; ?>"
async></script>

Cart Page Messaging

<!-- Cart total messaging -->
<klarna-placement
data-key="credit-promotion-badge"
data-locale="en-US"
data-purchase-amount="<?php echo intval( $cart_total * 100 ); ?>"
></klarna-placement>

Sezzle Installment Payments

Alternative buy now, pay later option with widget.

Configuration

// Sezzle settings
define( 'SEZZLE_MERCHANT_ID', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' );
define( 'SEZZLE_ENVIRONMENT', 'production' ); // or 'sandbox'

Widget Integration

<!-- Product page widget -->
<div class="sezzle-widget"
data-amount="<?php echo intval( $price * 100 ); ?>"
data-alignment="left">
</div>

<script src="https://widget.sezzle.com/v1/javascript/price-widget?uuid=<?php echo SEZZLE_MERCHANT_ID; ?>"></script>

Installment Calculator

// Show installment breakdown
const installmentAmount = (price / 4).toFixed(2);

document.querySelector('.sezzle-installments').innerHTML = `
4 interest-free payments of <strong>$${installmentAmount}</strong> with Sezzle
`;

Facebook Pixel

Conversion tracking for Facebook/Instagram ads.

Configuration (via GTM)

<!-- Facebook Pixel Base Code (GTM Custom HTML Tag) -->
<script>
!function(f,b,e,v,n,t,s)
{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=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>

Standard Events

// View content (product page)
fbq('track', 'ViewContent', {
content_name: 'Scent Blocker Jacket',
content_category: 'Jackets',
content_ids: ['BC123456'],
content_type: 'product',
value: 149.99,
currency: 'USD',
});

// Add to cart
fbq('track', 'AddToCart', {
content_ids: ['BC123456'],
content_name: 'Scent Blocker Jacket',
content_type: 'product',
value: 149.99,
currency: 'USD',
});

// Purchase
fbq('track', 'Purchase', {
value: 149.99,
currency: 'USD',
content_ids: ['BC123456'],
content_type: 'product',
});

Tracking Best Practices

  1. Consent Management: Implement cookie consent banner
  2. Data Layer Consistency: Use standardized event names
  3. PII Protection: Never pass email/phone in client-side tracking
  4. Event Deduplication: Use unique event IDs
  5. Server-Side Tracking: Use for sensitive conversions
  6. Testing: Use GTM Preview mode and GA4 DebugView

Troubleshooting

Check Data Layer

// View all data layer pushes
console.table(window.dataLayer);

// Monitor new pushes
window.dataLayer.push = new Proxy(window.dataLayer.push, {
apply: function(target, thisArg, argumentsList) {
console.log('Data Layer Push:', argumentsList[0]);
return target.apply(thisArg, argumentsList);
}
});

Klaviyo Debug

// Check Klaviyo queue
console.log(_learnq);

// Test identify
_learnq.push(['identify', {
'$email': '[email protected]',
'$first_name': 'Test',
}]);

GTM Preview Mode

  1. Open GTM container
  2. Click "Preview"
  3. Enter site URL
  4. Debug in Tag Assistant

GA4 DebugView

// Enable debug mode
window.gtag('config', 'G-XXXXXXXXXX', {
'debug_mode': true
});