This guide covers implementing SEO features using the Buying Buddy SDK for PHP. Follow these instructions to optimize your property listings for search engines.
Prerequisites
Before implementing SEO features, ensure you have:
- Completed basic SDK setup (see SDK Overview & Setup)
- Modified your JavaScript plugin to use
seo : "true"
- Added the SDK to your pages
SEO Benefits Overview
The SDK provides three main SEO enhancements:
1. Indexable Listings
Display widgets (List Widget, Gallery Widget) output HTML with links that search engines can crawl and index.
2. SEO-Friendly URLs
Property details pages use clean URLs without query parameters (e.g., /property/123-main-street
instead of /details.php?property_id=123
).
3. Dynamic Meta Data
Automatically generates optimized title tags, meta descriptions, and Open Graph tags using actual property information.
Required JavaScript Configuration
Ensure your Buying Buddy JavaScript plugin is configured correctly for SEO:
<!-- Buying Buddy plugin --> <script src="https://www.mbb2.com/version3/css/theme/acid/[ACTIVATION_KEY]"></script> <script> var MBB = { seo : "true", data:{ acid : "[ACTIVATION_KEY]" } }; function mbbMapLoaded(){ MBB.googleMaps = true; }; </script> <script src='https://maps.googleapis.com/maps/api/js?callback=mbbMapLoaded&libraries=places&key=[YOUR_GOOGLE_MAPS_API_KEY]'></script> <script src="https://d2w6u17ngtanmy.cloudfront.net/scripts/my-buying-buddy.5.0.js.gz"></script> <!-- End Buying Buddy plugin -->
Critical: The seo : "true"
setting is required for SEO features to work. This must be loaded in the <head> of all pages.
SEO Object Implementation
Available SEO Objects
The SDK provides these SEO objects for property details pages:
$propertyObj->title
- Optimized page title$propertyObj->h1
- Optimized H1 heading$propertyObj->meta_description
- Meta description with property details$propertyObj->meta_keywords
- Relevant keywords$propertyObj->property_address
- Property address$propertyObj->og_tags
- Open Graph tags for social sharing
Implementation Example
PHP Setup:
<?php require_once "mbb/MyBuyingBuddy.php"; $mbbObj = new MyBuyingBuddy( array( "api_key" => "[YOUR_API_KEY]", "acid" => "[ACTIVATION_KEY]" ) ); $propertyObj = $mbbObj->getWidget( "MBBv3_SearchDetails", array("property_id" => $mbbObj->getPropertyIdFromURL()) ); ?>
HTML Head Section:
<head> <title><?php echo $propertyObj->title?></title> <meta name="description" content="<?php echo $propertyObj->meta_description?>"> <meta name="keywords" content="<?php echo $propertyObj->meta_keywords?>"> <?php echo $propertyObj->og_tags?> </head>
HTML Body Section:
<body> <h1><?php echo $propertyObj->h1?></h1> <div id="MBBv3_SearchDetails"> <?php echo $propertyObj->html?> </div> </body>
Complete Property Details Page Example
<?php require_once "mbb/MyBuyingBuddy.php"; $mbbObj = new MyBuyingBuddy( array( "api_key" => "[YOUR_API_KEY]", "acid" => "[ACTIVATION_KEY]" ) ); $loginObj = $mbbObj->getWidget("MBBv3_LoginPanel", array("filter" => "layout:horizontal") ); $propertyObj = $mbbObj->getWidget( "MBBv3_SearchDetails", array("property_id" => $mbbObj->getPropertyIdFromURL()) ); ?> <!DOCTYPE html> <html> <head> <title><?php echo $propertyObj->title?></title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="description" content="<?php echo $propertyObj->meta_description?>"> <meta name="keywords" content="<?php echo $propertyObj->meta_keywords?>"> <!-- Buying Buddy plugin --> <script src="https://www.mbb2.com/version3/css/theme/acid/[ACTIVATION_KEY]"></script> <script> var MBB = { seo : "true", data:{ acid : "[ACTIVATION_KEY]" } }; function mbbMapLoaded(){ MBB.googleMaps = true; }; </script> <script src='https://maps.googleapis.com/maps/api/js?callback=mbbMapLoaded&libraries=places&key=[YOUR_GOOGLE_MAPS_API_KEY]'></script> <script src="https://d2w6u17ngtanmy.cloudfront.net/scripts/my-buying-buddy.5.0.js.gz"></script> <!-- End Buying Buddy plugin --> <?php echo $propertyObj->og_tags?> </head> <body> <h1><?php echo $propertyObj->h1?></h1> <div id="MBBv3_SearchDetails"> <?php echo $propertyObj->html?> </div> </body> </html>
SEO-Friendly URLs
HTACCESS Configuration
Create SEO-friendly URLs by setting up URL rewriting. This example redirects all /property/*
requests to a single PHP file:
RewriteEngine on RewriteRule ^property.*$ property.php [L] RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L]
Custom Search Pages
For SEO-friendly search result pages, you can create custom URLs like /city/denver
or /price-range/500k-600k
:
<?php // Example: /city/denver $city = "denver"; // Extract from URL $filter = "mls_id:ca64+listing_status:active+city:{$city}+limit:10+order:create_dt desc"; $resultsObj = $mbbObj->getWidget("MBBv3_FeaturedGallery", array("filter" => $filter)); ?> <div id="MBBv3_FeaturedGallery" filter="<?php echo $filter; ?>"> <?php echo $resultsObj->html?> </div>
URL Parameter Handling
For pages that accept URL parameters, pass them to the widget:
<?php $resultsObj = $mbbObj->getWidget("MBBv3_ListingResults", array("filter" => $_GET["filter"])); ?> <div id="MBBv3_ListingResults" filter="<?php echo $_GET["filter"]; ?>"> <?php echo $resultsObj->html?> </div>
Widget-Specific SEO Implementation
Display Widgets (List & Gallery)
These widgets automatically generate SEO-friendly links when using the SDK:
<?php $widgetParams = array( "filter" => "mls_id:ca64+city:DENVER", "limit" => 20, "order" => "create_dt desc" ); $listObj = $mbbObj->getWidget("MBBv3_FeaturedList", $widgetParams); ?> <div id="MBBv3_FeaturedList" filter="mls_id:ca64+city:DENVER"> <?php echo $listObj->html?> </div>
Results Widget
For search results pages:
<?php $resultsObj = $mbbObj->getWidget("MBBv3_ListingResults", array("filter" => "login-panel:false")); ?> <div id="MBBv3_ListingResults" filter="login-panel:false"> <?php echo $resultsObj->html?> </div>
Foundation Pages Configuration
Ensure your foundation pages (results and details) are properly configured:
- In Your Buying Buddy Account:
- Go to Widgets > Installation and Setup
- Click "Foundation Pages" tab
- Update page addresses to match your actual URLs
- Page Structure:
- Results page: Contains only the results widget
- Details page: Contains only the details widget
Testing Your SEO Implementation
- View Page Source: Check that meta tags are populated with property information
- Test URLs: Verify that property detail URLs work without query parameters
- Check Links: Ensure listing links in display widgets are crawlable
- Validate HTML: Use HTML validation tools to check for errors
Next Steps
- Widget Reference: See our Widget Implementation Guide for all widget types
- Advanced Features: Explore custom form building and API calls
- Office Features: Implement OfficeRoster with SDK for agent profiles