Skip to main content

Barns2 WooCommerce Restaurant Ordering GTM Event Listener

Track Barns2 WooCommerce Restaurant Ordering interactions in GTM. Monitor order placement, category browsing, and item selection events.

woocommercerestaurantorderingbarns2ecommercegtmga4food-delivery

Event fired

wcRestaurant_interactions

Key variable

wcRestaurant_action

Barns2 WooCommerce Restaurant Ordering

Overview

WooCommerce Restaurant Ordering by Barns2 transforms WooCommerce into a restaurant ordering system with menu categories, item options, and order management. This listener tracks the complete ordering flow.

Event fired: wcRestaurant_interactions Variable: wcRestaurant_action

Common Use Cases

  • Track online food orders as GA4 purchase events
  • Measure menu category browsing patterns
  • Identify most popular menu items from ordering data
  • Track order flow abandonment

Tracked Events

wcRestaurant_actionDescription
menu viewedMenu category opened
item addedItem added to order
item removedItem removed
order startedCheckout begun
order placedOrder confirmed
order cancelledOrder cancelled

Installation

html
<!-- GTM Custom HTML Tag: Restaurant Ordering Listener -->
<script>
(function() {
  function restPush(action, extra) {
    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push(Object.assign({
      'event': 'wcRestaurant_interactions',
      'wcRestaurant_action': action
    }, extra || {}));
  }

  jQuery(document).on('b2ro:menuViewed', function(e, data) {
    restPush('menu viewed', { categoryName: data && data.category });
  });

  jQuery(document).on('b2ro:itemAdded', function(e, data) {
    restPush('item added', {
      itemId: data && data.id,
      itemName: data && data.name,
      itemPrice: data && data.price,
      quantity: data && data.quantity
    });
  });

  jQuery(document).on('b2ro:itemRemoved', function(e, data) {
    restPush('item removed', {
      itemId: data && data.id,
      itemName: data && data.name
    });
  });

  jQuery(document).on('b2ro:orderStarted', function() {
    restPush('order started');
  });

  jQuery(document).on('b2ro:orderPlaced', function(e, data) {
    restPush('order placed', {
      orderId: data && data.orderId,
      orderTotal: data && data.total,
      itemCount: data && data.items && data.items.length
    });
  });
})();
</script>

Data Layer Output

Order Placed

json
{
  "event": "wcRestaurant_interactions",
  "wcRestaurant_action": "order placed",
  "orderId": "order_12345",
  "orderTotal": "45.50",
  "itemCount": 3
}

Trigger Configuration

Trigger: Custom Event | wcRestaurant_interactions

Conversion:

Condition: wcRestaurant_action | equals | order placed

GA4 Mapping

GA4 EventConditionParameters
purchaseorder placedtransaction_id, value, items
add_to_cartitem addeditem_id, item_name, price
begin_checkoutorder started

Related Listeners