Implement > Display > BVSEO

BVSEO

Search engine optimization (SEO) is critical to boosting your website traffic from organic searches. Bazaarvoice's server-side SEO solution (BVSEO) integrates into the top-level domain of your website and provides better results and support for search engines other than Google. The server-side solution organizes consumer-generated content (CGC) for increased overall search efficiency, and it complies with current SEO best practices to ensure that all search engines index valuable CGC.

In addition, our client-side JavaScript integration is provided by default with our hosted solution and takes advantage of Google’s enhanced JavaScript indexing capabilities. If your search traffic comes largely from Google, the client-side JavaScript integration provides similar SEO benefit with less overhead. Together, the server-side and client-side SEO solutions provide outstanding SEO performance and deliver an optimized user experience.

Note: If your existing implementation uses the scout file (bvapi.js), refer to the BVSEO v1 documentation instead of the information included in this topic. However, Bazaarvoice encourages you to migrate to v2 (using the BV loader file, bv.js) for performance improvements and future innovations.

Learn more about optimizing search:

Conversations and SEO (3:16)

Getting to five-star SEO: Advice from Bazaarvoice experts

Supported features

Bazaarvoice-managed content is injected into your pages' source code via a server-side software development kit (SDK). Here is the list of supported features for Java, .NET, and PHP.

Feature Description Java .NET PHP
Ratings and Reviews Product ratings and reviews content is injected using getContent, getReviews, and getAggregateRating.
Questions and Answers Product questions and answers content is injected using getContent.
Spotlights Spotlights content is accessed using getContent.
Seller ratings Seller ratings content is accessed using getContent.
Multiple configuration support Multiple configurations are supported in a single environment.  
SSL Access content using a secured layer.
Proxy support Access content using proxy gateways in a restricted network.
Debugging Troubleshooting information is available for debugging purpose.
Charset Supports user-specific character sets when retrieving content.

Setup overview

To set up BVSEO, your technical team needs to perform the following:

Compatible JavaScript for Google

Consumer-generated content (CGC) served by Bazaarvoice takes advantage of Google's expanded JavaScript indexing performance. Understanding the following concepts can help you get more search engine optimization (SEO) benefit when using JavaScript to deploy CGC.

schema.org markup

Bazaarvoice adds correctly formed schema.org markup to CGC served to your web pages. When Google indexes this markup, the likelihood of review rich snippets appearing in search results increases.

Note: To ensure the markup is read correctly, add schema.org itemtype and itemprop declarations to your pages and adjust your SEO settings in the Conversations configuration hub. Refer to Add schema.org markup for detailed instructions and code examples.

Links between CGC content pages

When CGC content spans more than one page, Bazaarvoice uses href links between pages, allowing search engines to index the content more easily.

When shoppers view a product page that contains more than one page of reviews, they interact only with the JavaScript. The URL does not change. Bazaarvoice dynamically creates href links between pages of CGC for search indexing only, allowing search engines to point shoppers directly to relevant results.

Note: If you have an existing deployment, you might need to redeploy to production to see this SEO benefit.

Pagination link format

Bazaarvoice appends a bvstate parameter to URLs. This parameter uses key/value pairs to define the content type and page of CGC to display. The following table lists examples of possible uses of the bvstate parameter.

Parameter text Explanation

?bvstate=ct:r/pg:2

  • Content type: ratings and reviews
  • Page: 2

?bvstate=ct:q/pg:4

  • Content type: questions and answers
  • Page: 4

Bazaarvoice adds the bvstate parameter to URLs in the canonical tag for your implementation. Consumers only encounter the bvstate parameter when following links from search results.

Note: The bvstate parameter replaces pagination parameters formerly used by Bazaarvoice such as bvrrp, bvqap, bvsyp, and bvpage. Older parameters will be phased out over time.

Prepare for SEO setup

Begin your implementation by answering questions in the following sections to help eliminate surprises and delays during setup.

Then, make sure you meet the following prerequisite conditions:

  • Verify that one of the following frameworks is installed:
    • Java framework 5 (1.5) or above
    • .NET framework 2.0 or above
    • PHP 5.5 or above with curl and Mbstring library

  • Use the Bazaarvoice hosted display, such as JavaScript or iFrame.
  • Provide a product catalog to Bazaarvoice.
  • Ensure that your product pages incorporate schema.org markup.
  • Have at least one product with reviews in the system.

During setup, you must know your BVSEO:

  • Cloud key
  • Root folders
  • Product IDs

If you do not know these values, file a support ticket to request the information.

Configure SEO options

Follow these steps to access SEO in the Conversations configuration hub:

  1. Log in to the Bazaarvoice workbench .
  2. Under Settings » Manage Applications. The Site Manager page appears.
  3. From the Implementations list, locate the Conversations implementation where you want to configure SEO settings. Click the Edit button next to the implementation to open the configuration hub.
  4. Click SEO on the left side of the page under Settings. The SEO page appears.
  5. Make selections or enter values for each of the following SEO options in the configuration hub for your implementation:
    • Enable SEO file publishing—Select Enabled (default) to publish SEO content to the cloud or compressed SEO file archive. You must also provide values for Cloud key or ZIP/GZIP filename properties.
    • Root folder—Enter the syntax to use for the name of the root folder in the cloud and/or compressed file. Use these tokens to inject dynamic properties into the filename: {clientname}, {displaycode}, {deploymentzone}, {locale}. Example: bv-acmeinc-7012-MainSite-en_US.
    • SEO-friendly pagination—Users and search engines react favorably when your site contains multiple pages for a product, and when pages after the product overview contain about 30 reviews each. Select Enabled (default) to use multiple-page settings for your product pages.
    • Cloud key—Enter your cloud key value to configure the BVSEO SDK. Be sure to include the entire value, not just the encrypted portion.  If you do not have a cloud key, request one by submitting a support ticket through Spark .
    • schema.org/Product type—Ignore this option, which has been deprecated and is no longer used.
    • Compression type—Select the compression type for SEO feeds: ZIP (Windows) or GZIP (UNIX). If disabled, archive files will not be published to the SFTP server.
    • ZIP/GZIP filename—This option is required for compressed file publishing. Enter the syntax to use for the compressed SEO filename. Use these tokens to inject dynamic properties into the filename: {clientname}, {displaycode}, {deploymentzone}. The file extension is automatically appended based on the compression type you select. Example: bv_acmeinc_7012_MainSite-en_US.zip.
    • Automatically edit canonical tags for search-friendly pagination—If canonical tags are used on pages where BVSEO is implemented, they must either be updated or removed when the product contains more than one page (more than eight) of reviews. This is because BVSEO paginates the product page so that all reviews are in the search engines’ index, and canonical tags that point away from a pagination URL will cause search engines to ignore the paginated content. Select Enabled (default) to automatically update these tags.
    • AggregateRating tag location—Google will only display rich snippet stars for pages with one schema.org AggregateRating tag. Choose a location from the following options to insert this tag:
      • Primary Ratings Summary (default)—Inserts the AggregateRating tag on the primary ratings summary page. Bazaarvoice recommends this option.
      • Reviews Container—Inserts the AggregateRating tag at the top of the reviews container.
      • Remove Aggregate Rating tag—Excludes the AggregateRating tag.

Add code using the Java SDK

The following requirements are necessary to install the Java SDK.

  • Familiarity with Java and Java EE development and deployment to application servers
  • Java 1.6 or above
  • BVSEO SDK library for Java

Bazaarvoice follows the Oracle support levels for the JRE supported by the Java SDK. For more information, refer to the Oracle Java SE Support Roadmap .

Download the SDK

Download the appropriate Java SDK file from the following location: BVSEO Java SDK .

After you unzip the file, choose the package from the following table that best suits your environment:

Java SDK Description
Bv-seo-sdk-{version}-jar-with-dependencies.jar All dependencies are contained in the file.
Bv-seo-sdk-{version}.jar No dependencies are contained in the file.
Bv-seo-sdk-{version}-osgi.jar This SDK is for OSGi supported environments only.

If you're not sure which SDK you should use, choose one based on the following scenarios.

  • My environment supports OSGi—Use the Bv-seo-sdk-{version}-osgi.jar SDK. This is the recommended library for OSGi environments.
  • My environment does not support OSGi—Use the Bv-seo-sdk-{version}-jar-with-dependencies.jar file if there are no version conflicts caused by the SDK libraries used in your environment.
  • My environment does not support OSGi and I have version conflicts—Use bv-seo-sdk-{version}.jar file. This library does not contain any dependencies, so you must identify missing libraries and supply them manually. This can be done during compilation if there are compilation errors, or during runtime if there are "class not found" errors.

Customize the SDK

The BVSEO SDKs suit most environments. However, the BVSEO SDKs are open sourced under an Apache license and can be customized to your needs. Any customizations must be done at your own risk and will not be supported by Bazaarvoice.

Fork from the following link to perform customizations: github.com/bazaarvoice/seo_sdk_java

Set up your project

Follow these steps to set up your project.

To set up your project, configure settings in your server-side Java environment and prepare your development environment.

Configure your server environment

Note: This section applies only to clients using Java EE to deploy their site.

The Java SDK supports the collection of user agent strings, which allows us to provide consumer-generated content (CGC) better tailored to consumers. If your company uses Java EE to host your website, you must update your web.xml file , located in your WEB-INF folder.

Copy and paste the following text into the <web-app> element in your web.xml file:

<filter>
    <filter-name>BVSeoSdkRequestFilter</filter-name>
    <filter-class>com.bazaarvoice.seo.sdk.servlet.RequestFilter</filter-class>
</filter>
<filter-mapping> 
    <filter-name>BVSeoSdkRequestFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Configure your development environment

Follow these steps to configure your development environment. Example values for each step are provided along with example code. Refer to Java code examples for full example code for various scenarios that you can configure to your needs.

  1. Create a web project from your IDE.

    Example: sampleweb

  2. Paste the SDK library under WebContent/WEB-INF/lib.

    Example: bv-seo-sdk-{version}-jar-with-dependencies.jar

  3. Create a JSP page in the WebContent folder. Usually this JSP page will be your product detail page (PDP).

    Example: sample.jsp

  4. Set up the JSP file.

    Example: Coding sample.jsp

  5. Export the project as a WAR file and deploy to Tomcat .

    Example: The project is run from IDE, which uses Tomcat.

  6. Open the URL and view the page source to see the injected content.

    Example:  http://localhost:8080/sampleweb/sample.jsp

Your project structure should look like the following example:

Set up the JSP file

Follow these steps to set up the JSP file you created in the previous procedure.

  1. Configure using BVConfiguration.
    The example code uses BVSdkConfiguration class, which is an implementation of BVConfiguration. Ensure that com.bazaarvoice.seo.sdk.config.BVConfiguration is imported in the page and add appropriate configurations using addProperty. Refer to the BVConfiguration section of Java SDK inputs and features for details.
    The addProperty method is used to add configuration/properties to the BVSdkConfiguration and takes parameters enum type BVClientConfig and String type value. The example shows various properties already added.
  2. Set the parameters for your product detail page using BVParameters.
    This step supplies details specific to product page contents. Set parameters using the BVParameters class, which can be imported from com.bazaarvoice.seo.sdk.model.BVParameters. Be sure to include mandatory fields as shown in the Java code examples.
  3. Get the contents using BVManagedUIContent.
    BVUIContent has three APIs. Refer to Java SDK inputs and features for more information on each API. The example uses the getContent API and BVManagedUIContent, which is an implementation of BVUIContent. While instantiating BVManagedUIContent, supply the BVSdkConfiguration and invoke getContent passing BVParameters. This API returns a string that contains the BVSEO content, which you can use in the JSP.

Test your application

Follow these steps to test and debug your application of the Java SDK.

  1. Deploy a WAR file or use an application server such as Tomcat to run your application.
  2. Access the application via URL.

    Example: http://localhost:8080/SampleWeb/sample.jsp

  3. View the page source. You should see review contents and SEO <metadata> tags inside the BVRRContainer.
  4. Verify that SEO metadata tags appear after every review, as shown in the following code sample:
<ul id="BVSEOSDK_meta" style="display:none !important">
	<li data-bvseo="sdk">bvseo_sdk, java_sdk, bvseo-x.y.z</li>
	<li data-bvseo="sp_mt">getContent, method:CLOUD, 188ms</li>
	<li data-bvseo="ct_st">REVIEWS, PRODUCT</li>
</ul>

If the SEO metadata tags do not match, troubleshoot and take appropriate action based on the error message in the SEO <metadata> tag.

To debug your application, complete these steps:

Step 1: Add bvreveal=debug

  1. Add the bvreveal=debug parameter to the URL of any page where BVSEO is implemented.

    Example: http://yoursite.net/ExampleGetContent.aspx?bvreveal=debug

    The bvreveal=debug parameter adds BVSEOSDK_meta and BVSEOSDK_DEBUG lists to the source code, which contain information about your implementation. If there is no consumer-generated content (CGC), bvseo-msg will provide more details.

    Note: If pageURL is not set up correctly, bvreveal=debug will not work. If you do not provide a debug footer, pagination links may be incorrect.
  2. View the page's source code to find information about your implementation. This information is included in BVSEOSDK_meta and BVSEOSDK_DEBUG. Refer to the full example code at the end of this section.

Step 2: Check for content

Check to see if content exists for the requested contentURL, as described in the following steps:

  1. Find the contentURL in the BVSEOSDK_DEBUG list. Example: <li data-bvseo="contentURL">http://seo-stg.bazaarvoice.com/myshco-69cb945801532dcfb57ad2b0d2471b68/Main_Site-en_US/reviews/product/1/5000001.htm</li>
  2. From the terminal, run the curl –i command. Example: curl –i "http://seo-stg.bazaarvoice.com/myshco-69cb945801532dcfb57ad2b0d2471b68/Main_Site-en_US/reviews/product/1/5000001.htm"

If the curl command does not return content, it could be a firewall issue or no content exists for this ProductID. Contact your Bazaarvoice representative for further troubleshooting.

Error messages

The following error messages may appear when debugging.

  • HTTP status code of 0 was returned (or) connection refused to seo-stg.bazaarvoice.com—Indicates that a firewall exists on your network. Outbound requests from your network may be blocked by your firewall. Contact your IT team to sort out firewall issues.
  • The resource to the URL or file is currently unavailable—Indicates that something is wrong with the implementation configuration or no content was generated for the specified product.

Example:

<ul id="BVSEOSDK_meta" style="display:none!important"> <li data-bvseo="sdk">bvseo_sdk, java_sdk, x.y.z</li> <li data-bvseo="sp_mt">getContent, method:CLOUD, 656ms</li> <li data-bvseo="ct_st">QUESTIONS, PRODUCT</li> <li data-bvseo="ms">bvseo-msg: The resource to the URL or file is currently unavailable.;</li> </ul> <ul id="BVSEOSDK_DEBUG" style="display:none;"> <li data-bvseo="crawlerAgentPattern">yandex</li> <li data-bvseo="staging">true</li> <li data-bvseo="seo.sdk.enabled">true</li> <li data-bvseo="testingProductionS3Hostname">seo-qa.bazaarvoice.com</li> <li data-bvseo="stagingS3Hostname">seo-stg.bazaarvoice.com</li> <li data-bvseo="seo.sdk.execution.proxy.host">none</li> <li data-bvseo="seo.sdk.execution.timeout.bot">2000</li> <li data-bvseo="socketTimeout">2000</li> <li data-bvseo="testingStagingS3Hostname">seo-qa-stg.bazaarvoice.com</li> <li data-bvseo="cloudKey">myshco-3e3001e88d9c32d19a17cafacb81bec7</li> <li data-bvseo="localSEOFileRoot">/</li> <li data-bvseo="bv.root.folder">9344</li> <li data-bvseo="seo.sdk.execution.proxy.port">0</li> <li data-bvseo="testing">false</li> <li data-bvseo="productionS3Hostname">seo.bazaarvoice.com</li> <li data-bvseo="connectTimeout">2000</li> <li data-bvseo="loadSEOFilesLocally">false</li> <li data-bvseo="seo.sdk.charset">UTF-8</li> <li data-bvseo="seo.sdk.ssl.enabled">false</li> <li data-bvseo="includeDisplayIntegrationCode">false</li> <li data-bvseo="seo.sdk.execution.timeout">1500</li> <li data-bvseo="en">true</li> <li data-bvseo="pn">bvseo-2</li> <li data-bvseo="userAgent">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36</li> <li data-bvseo="baseURI">http://bvvseodotnetdevelopment.azurewebsites.net/ExampleGetContent.aspx</li> <li data-bvseo="pageURI">http://bvvseodotnetdevelopment.azurewebsites.net/ExampleGetContent.aspx?bvstate=pg:2/ct:q/reveal:debug</li> <li data-bvseo="subjectId">5000001</li> <li data-bvseo="contentType">questions</li> <li data-bvseo="subjectType">product</li> <li data-bvseo="contentURL">http://seo-stg.bazaarvoice.com/myshco-3e3001e88d9c32d19a17cafacb81bec7/9344/questions/product/2/5000001.htm</li> </ul>

Java SDK inputs and features

This topic provides details about the core classes in the BVSEO SDK, including configuration options and methods of use for the Java platform.

BVConfiguration

BVConfiguration configures the BVSEO SDK. It has two APIs:

  1. BVConfiguration.addProperty—Adds properties to BVConfiguration.
  2. BVConfiguration.getProperty—Gets properties from BVConfiguration.
    Note: BVConfiguration.getProperty is for Bazaarvoice internal use only.

BVConfiguration is an interface under com.bazaarvoice.seo.sdk.config and the known implementation class is com.bazaarvoice.seo.sdk.config.BVSdkConfiguration.

Java usage

BVConfiguration bvConfiguration = new BVSdkConfiguration();

Adding properties using BVConfiguration.addProperty

Adding and setting attributes in BVConfiguration changes the functionality and behavior of the SDK. Configuration options are listed in the SDK configuration attributes table.

Set attributes using BVConfiguration.addProperty (BVClientConfig bvClientConfig, String value).

Java usage

bvConfiguration.addProperty(BVClientConfig.CLOUD_KEY, “your_cloud_key”);

BVParameters

BVParameters are the page or product display page-level parameters that access the SEO contents of a particular product. Use the attributes listed in the following SDK parameters table to set field values.

This is a model used by the SDK in the com.bazaarvoice.seo.sdk.model.BVParameters class.

Java usage

BVParameters bvParameters = new BVParameters();
bvParameters.setSubjectId(“exampleExternalId”);
bvParameters.set…

BVUIContent

BVUIContent is used to get SEO contents after you supply the correct BVConfiguration and BVParameters.

BVUIContent exposes three APIs: getContent, getReviews, and getAggregateRating. Each of these requires valid BVParameters. The following BVUIContent APIs table explains how to use the APIs.

BVUIContent is the interface located in package com.bazaarvoice.seo.sdk. The implementation class is com.bazaarvoice.seo.sdk.BVManagedUIContent.

Java usage

BVUIContent bvUIContent = new BVManagedUIContent(bvConfiguration);
String theContent = bvUIContent.getContent(bvParameters);

Java code examples

The examples contained in this topic deploys the SDKs directly in the presentation layer, which simplifies the code but is not a recommended practice. The purpose of this example is to show an SDK integration. Ensure that you update your code to use correct values.

Note: All examples demonstrate integration that retrieves files using the cloud, unless otherwise specified.

Add code using the .NET SDK

The following requirements are necessary to install the .NET SDK:

  • Familiarity with .NET development and Visual Studio IDE
  • .NET Framework 3.5 or above
  • Visual Studio
  • BVSEO SDK library for .NET

Download the SDK

Download the appropriate .NET SDK file from the following location: BVSEO .NET SDK .

The following table describes the files that are included in your download.

Filename Description
BVSeoSdkDotNet.dll BVSEO library that supports both cloud SEO and the local file method.
Commons.dll Library dependency for Apache Commons.
log4net.dll Library dependency for logging.
NVelocity.dll Library dependency for Apache NVelocity, which handles templating.
BVSeoSdkDotNet.pdb Contains debugging information.

Customize the SDK

The BVSEO SDKs suit most environments. However, the BVSEO SDKs are open sourced under an Apache license and can be customized to your needs. Any customizations must be done at your own risk and will not be supported by Bazaarvoice.

Fork from the following link to perform customizations: github.com/bazaarvoice/seo_sdk_dotnet

Set up your project

Follow these steps to set up your project. Each step includes an example value.

  1. Create an ASP.NET web application project in Visual Studio IDE, then select an empty template.

    Example: SampleWebApplication

  2. Unzip the contents from the downloaded SDK library zip file.
  3. From the Solution Explorer, expand the new project and right click references to add the following libraries from the SDK binary: BVSeoSdkDotNet.dll, Commons.dll, log4net.dll, and NVelocity.dll.
  4. Add a new aspx page to your application. Usually this page will be your product detail page (PDP).

    Example: Sample.aspx example code

  5. Add necessary code in Sample.aspx and Sample.aspx.cs as shown in the example code.
  6. Right-click Sample.aspx and add it as a startup page.
    Note: For steps 6 and 7, ensure that SampleWebApplication is your startup project if you have more than one project in your solution.
  7. Press Crtl+F5 to run your application, or open the debug menu and select Start Without Debugging.

Set up the .NET code

Follow these steps to set up the .NET code:

  1. Configure using BVConfiguration.
  2. Set the parameters for your PDP using BVParameters.
  3. Get the contents using BVManagedUIContent.

Refer to .NET SDK inputs and features for more detailed information on each of these steps.

Refer to .NET code examples for code examples.

Test your application

Follow these steps to test and debug your application of the .NET SDK:

  1. Access the application via URL. Running your application using IDE should open up your page automatically if you have set it up as a startup page.

    Example: http://localhost:8080/Sample.aspx

  2. View the page source. You should see review contents and SEO <metadata> tags inside the BVRRContainer.
  3. Verify that SEO <metadata> tags, as shown in the following code sample, appear after every review.
<ul id="BVSEOSDK_meta" style="display:none!important;">
 	<li data-bvseo="sdk">bvseo_sdk, net_sdk, x.y.z.0</li>
 	<li data-bvseo="sp_mt">getReviews, method:CLOUD, 33ms</li>
 	<li data-bvseo="ct_st">REVIEWS, PRODUCT</li>
 </ul>

If the SEO <metadata> tags do not match as shown in the code sample, troubleshoot and take appropriate action based on the error message displayed in the SEO <metadata> tag.

To debug your application, complete these steps:

Step 1: Add bvreveal=debug

  1. Add the bvreveal=debug parameter to the URL of any page where BVSEO is implemented.

    Example: http://yoursite.net/ExampleGetContent.aspx?bvreveal=debug

    The bvreveal=debug parameter adds BVSEOSDK_meta and BVSEOSDK_DEBUG lists to the source code, which contain information about your implementation. If there is no consumer-generated content (CGC), bvseo-msg will provide more details.

    Note: If pageURL is not set up correctly, bvreveal=debug will not work. If you do not provide a debug footer, pagination links may be incorrect.
  2. View the page's source code to find information about your implementation. This information is included in BVSEOSDK_meta and BVSEOSDK_DEBUG. Refer to the full example code at the end of this section.

Step 2: Check for content

Check to see if content exists for the requested contentURL, as described in the following steps:

  1. Find the contentURL in the BVSEOSDK_DEBUG list. Example: <li data-bvseo="contentURL">http://seo-stg.bazaarvoice.com/myshco-69cb945801532dcfb57ad2b0d2471b68/Main_Site-en_US/reviews/product/1/5000001.htm</li>
  2. From the terminal, run the curl –i command. Example: curl –i "http://seo-stg.bazaarvoice.com/myshco-69cb945801532dcfb57ad2b0d2471b68/Main_Site-en_US/reviews/product/1/5000001.htm"

If the curl command does not return content, it could be a firewall issue or no content exists for this ProductID. Contact your Bazaarvoice representative for further troubleshooting.

Error messages

The following error messages may appear when debugging.

  • HTTP status code of 0 was returned (or) connection refused to seo-stg.bazaarvoice.com—Indicates that a firewall exists on your network. Outbound requests from your network may be blocked by your firewall. Contact your IT team to sort out firewall issues.
  • The resource to the URL or file is currently unavailable—Indicates that something is wrong with the implementation configuration or no content was generated for the specified product.

Example:

<ul id="BVSEOSDK_meta" style="display:none!important"> <li data-bvseo="sdk">bvseo_sdk, net_sdk, x.y.z.0</li> <li data-bvseo="sp_mt">getContent, method:CLOUD, 656ms</li> <li data-bvseo="ct_st">QUESTIONS, PRODUCT</li> <li data-bvseo="ms">bvseo-msg: The resource to the URL or file is currently unavailable.;</li> </ul> <ul id="BVSEOSDK_DEBUG" style="display:none;"> <li data-bvseo="crawlerAgentPattern">yandex</li> <li data-bvseo="staging">true</li> <li data-bvseo="seo.sdk.enabled">true</li> <li data-bvseo="testingProductionS3Hostname">seo-qa.bazaarvoice.com</li> <li data-bvseo="stagingS3Hostname">seo-stg.bazaarvoice.com</li> <li data-bvseo="seo.sdk.execution.proxy.host">none</li> <li data-bvseo="seo.sdk.execution.timeout.bot">2000</li> <li data-bvseo="socketTimeout">2000</li> <li data-bvseo="testingStagingS3Hostname">seo-qa-stg.bazaarvoice.com</li> <li data-bvseo="cloudKey">myshco-3e3001e88d9c32d19a17cafacb81bec7</li> <li data-bvseo="localSEOFileRoot">/</li> <li data-bvseo="bv.root.folder">9344</li> <li data-bvseo="seo.sdk.execution.proxy.port">0</li> <li data-bvseo="testing">false</li> <li data-bvseo="productionS3Hostname">seo.bazaarvoice.com</li> <li data-bvseo="connectTimeout">2000</li> <li data-bvseo="loadSEOFilesLocally">false</li> <li data-bvseo="seo.sdk.charset">UTF-8</li> <li data-bvseo="seo.sdk.ssl.enabled">false</li> <li data-bvseo="includeDisplayIntegrationCode">false</li> <li data-bvseo="seo.sdk.execution.timeout">1500</li> <li data-bvseo="en">true</li> <li data-bvseo="pn">bvseo-2</li> <li data-bvseo="userAgent">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36</li> <li data-bvseo="baseURI">http://bvvseodotnetdevelopment.azurewebsites.net/ExampleGetContent.aspx</li> <li data-bvseo="pageURI">http://bvvseodotnetdevelopment.azurewebsites.net/ExampleGetContent.aspx?bvstate=pg:2/ct:q/reveal:debug</li> <li data-bvseo="subjectId">5000001</li> <li data-bvseo="contentType">questions</li> <li data-bvseo="subjectType">product</li> <li data-bvseo="contentURL">http://seo-stg.bazaarvoice.com/myshco-3e3001e88d9c32d19a17cafacb81bec7/9344/questions/product/2/5000001.htm</li> </ul>

.NET SDK inputs and features

This topic provides details about the core classes in the BVSEO SDK, including configuration options and methods of use for the .NET platform.

BVConfiguration

BVConfiguration configures the BVSEO SDK. It has two APIs:

  1. BVConfiguration.addProperty—Adds properties to BVConfiguration.
  2. BVConfiguration.getProperty—Gets properties from BVConfiguration.
    Note: BVConfiguration.getProperty is for Bazaarvoice internal use only.

BVSdkConfiguration is an implementation interface for BVConfiguration. Make sure to add using BVSeoSdkDotNet.Config.

.NET usage

BVConfiguration bvConfig = new BVSdkConfiguration();

Adding properties

Adding and setting attributes in BVConfiguration changes the functionality and behavior of the SDK. Configuration options are listed in the following SDK configuration attributes table.

Set these attributes using the addProperty method on BVConfiguration.

.NET usage: bvConfig.addProperty(BVClientConfig.CLOUD_KEY, “your_cloud_key”);

SDK configuration attributes table

BVParameters

BVParameters are the page or product display page-level parameters that access the SEO contents of a particular product. Use the attributes listed in the following SDK parameters table to set field values.

This is a model used by the SDK that is added using BVSeoSdkDotNet.Model

.NET usage

BVParameters bvParameters = new BVParameters
{
BaseURI = <baseURI>,

SubjectId = “exampleExternalId”
};

Or

BVParameters bvParameters = new BVParameters();
bvParameters.SubjectId = “exampleExternalId”

SDK parameters

BVUIContent

BVUIContent is used to get SEO contents after you supply the correct BVConfiguration and BVParameters.

BVUIContent exposes three APIs: getContent, getReviews, and getAggregateRating. Each of these requires valid BVParameters. The following BVUIContent APIs table explains how to use the APIs.

BVManagedUIContent is an implementation for BVUIContent and is added using BVSeoSdkDotNet.Content.

.NET usage

BVUIContent bvUIContent = new BVManagedUIContent(bvConfig);
string theContent = bvUIContent.getContent(bvParameters);

BVUIContent API

.NET code examples

The examples contained in this topic deploy the SDK directly on an empty ASP.NET project with ASPX webform code behind a page, which simplifies the code but is not a recommended practice. The purpose of these examples is to show how an SDK integration is done. Ensure that you update your code to use proper values.

Note: If you are using a Web Site project, be sure to switch the CodeBehind page directive to CodeFile before copying the examples.

Add code using the PHP SDK

The following requirements are necessary to install the PHP SDK:

  • HTTP server or PHP built-in web server
  • PHP 5.5 or higher with curl and mbstring library

  • BVSEO SDK library for PHP
Note: Bazaarvoice supports only the current PHP versions as listed on the php.net supported versions page.

Download the SDK

Download the appropriate PHP SDK file from the following location: BVSEO PHP SDK .

The following files are included in the download.

Filename Description
Bvseosdk.php BVSEO library that supports both cloud SEO and the local file method.
BVFooter.php Used to generate content and debug the SDK footer.
BVUtility.php Common utility functions used by the BVSEO SDK library.

Customize the SDK

The BVSEO SDKs suit most environments. However, the BVSEO SDKs are open sourced under an Apache license and can be customized to your needs. Any customizations must be done at your own risk and will not be supported by Bazaarvoice.

Fork from the following link to perform customizations: github.com/bazaarvoice/seo_sdk_php

Set up your project

Follow these steps to set up your project. Example values for each step are provided, along with example code. Refer to PHP code examples for full example code for various scenarios that you can configure to your needs.

  1. Create a file.

    Example: sampleweb.php

  2. Include the bvseosdk.php.
  3. Instantiate the bv object.
  4. Call $bv->reviews->getReviews() inside <div data-bv-show="reviews" data-bv-productId="ExternalId"></div> to get the BVSEO content. This call will return the BVSEO HTML code as a string.

Test your application

Follow these steps to test your application of the PHP SDK.

  1. Upload the example file to a host folder and access the sample application using the URL.

    Example: http://localhost:8080/sampleweb.php

  2. View the page source. You should see review contents and SEO <metadata> tags inside the BVRRContainer.
  3. Verify that SEO <metadata> tags, as shown in the following code sample, appear after every review.
<ul id="BVSEOSDK_meta" style="display:none  !important">
	<li data-bvseo="sdk">bvseo_sdk, php_sdk, bvseo-x.y.z.0</li>
	<li data-bvseo="sp_mt">getContent, method:CLOUD, 188ms</li>
	<li data-bvseo="ct_st">REVIEWS, PRODUCT</li>
</ul>

If the SEO <metadata> tags do not match as shown in the code sample, troubleshoot and take appropriate action based on the error message displayed in the SEO <metadata> tag.

PHP SDK inputs and features

This topic provides details about the core classes in the BVSEO SDK, including configuration options and methods of use for the PHP platform.

Configuration

Configuration settings are added as BV class constructor parameters. Set configuration properties by placing them in the options array with the attribute in lowercase as a key and value.

PHP usage

Set EXECUTION_TIMEOUT to 5000 by adding it to the options array key with value of execution_timeout => 5000.

$bv = new BV(array(
// Required fields
'cloud_key' => 'myshco-3e3001e88d9c32d19a17cafacb81bec7',
'bv_root_folder' => 'Main_Site-ja_JP',
'subject_id' =>’5000001’,
// Our optional parameters
'execution_timeout' => 5000,
));

Adding properties

Adding and setting attributes changes the functionality and behavior of the SDK. Configuration options are listed in the following PHP SDK configuration attributesPHP SDK parameters tables.

All configuration settings are added when you instantiate the BV class.

PHP SDK configuration attributes

Content retrieval

After you create a BV class instance, it can call questions, reviews, and Spotlights.

PHP usage

$BVContent = $bv->reviews->getContent();

BVUIContent APIs

PHP code examples

The following code examples show the usage of BVSEO in PHP. Ensure that you update your code to use proper values.

Best practices

The following best practices will help you maximize SEO benefit on your product review pages.

Note: The default settings for BVSEO support these practices.

FAQs

Use the information in the following sections to troubleshoot your BVSEO implementation.

Bazaarvoice recommends you use the Safari web browser, available for Windows and Mac, for web-based testing.

Troubleshooting

Refer to the following sections to help troubleshoot your BVSEO implementation.

Note: Bazaarvoice recommends using the Safari web browser for web-based testing. Safari is available for both Windows and Mac.

Integration for new clients

  1. Install the Java, .NET, or PHP SDK.
  2. Define the cloud key, which is provided by Bazaarvoice.
  3. Define the root folder, which is provided by Bazaarvoice.
  4. Define the page URL by specifying the base_URL plus query strings and appended parameters. This is required regardless of whether your site uses query parameters. Bazaarvoice appends parameters for SEO pagination, and it is required that the page_URL capture these. Do not cache this on your side because the page_URL must update in real time.
  5. Define the base URL by specifying the canonical URL of the product page.
  6. Add the schema.org markup on the product page.
  7. If behind a firewall, contact your network or server operations team to whitelist seo.bazaarvoice.com and seo-stg.bazaarvoice.com.
  8. Set STAGING to TRUE when implementing in a non-production (staging) environment.

Examples:

Integration for existing clients

You must update your BVSEO integrations when you add the BV loader to your site.

Java and PHP

Make the following changes to your Java and PHP BVSEO integrations:

  • Replace <div id="BVRRSummaryContainer"> with <div data-bv-show="rating_summary" data-bv-productId="ExternalId">
  • Replace <div id="BVRRContainer"> with <div data-bv-show="reviews" data-bv-productId="ExternalId">
  • Replace <div id="BVQAContainer"> with <div data-bv-show="questions" data-bv-productId="ExternalId">

where:

  • data-bv-show—Instructs the BV loader to display the specified feature.
  • data-bv-productId—Instructs the BV loader to display the feature for a specified product ID. The product ID must match the ExternalId provided in the product catalog.

.NET

Make the following changes to your .NET BVSEO integrations:

  • Replace <div id="BVRRSummaryContainer" runat="server"> with <div id="SEO_BVRRSummaryContainer" runat="server" data-bv-show="rating_summary" data-bv-productId="ExternalId">
  • Replace <div id="BVRRContainer" runat="server"> with <div id="SEO_BVRRContainer" runat="server" data-bv-show="reviews" data-bv-productId="ExternalId">
  • Replace <div id="BVQAContainer" runat="server"> with <div id="SEO_BVQAContainer" runat="server" data-bv-show="questions" data-bv-productId="ExternalId">

where:

  • data-bv-show—Instructs the BV loader to display the specified feature.
  • data-bv-productId—Instructs the BV loader to display the feature for a specified product ID. The product ID must match the ExternalId provided in the product catalog.

Update the code referencing those element IDs as well:

  • Replace BVRRContainer.InnerHtml with SEO_BVRRContainer.InnerHtml
  • Replace BVRRSummaryContainer.InnerHtml with SEO_BVRRSummaryContainer.InnerHtm
  • Replace BVQAContainer.InnerHtml with SEO_BVQAContainer.InnerHtml

Be aware that changes made to BVSEO in the staging environment are updated once a week only, on Saturday.

Verify the following: