Skip to main content
All CollectionsReviews & QAIntegration
BayReviews Integration for Custom Platforms (API version 2)
BayReviews Integration for Custom Platforms (API version 2)
Danielle Fietkau avatar
Written by Danielle Fietkau
Updated this week

BayReviews offers built-in integration with major eCommerce platforms. If your eCommerce store platform is not listed, you can still integrate it via Custom API.

This guide is for custom-built or other e-commerce platforms, except for the following:

BigCommerce

Get started with BayReviews: A Detailed Step-by-Step Guide

STEP 1: Open your web browser and navigate to the BayReviews dashboard by clicking on the URL https://app.targetbay.com/.

STEP 2: Once you're on the BayReviews dashboard login page, enter your login credentials (username and password) in the provided fields. If you're a new user without an account, you can create one by clicking on the "SIGN UP HERE" button in the page's top right corner. Follow the prompts to register for a new account.

Step 3: Connecting Your Store:

  1. Store Details: Enter your email ID, store URL (web address), and store name(optional).

  2. Select Platform: Select "Others" as the e-commerce platform if your platform is not listed under "Select Your Ecommerce Platform."

  3. Connect to BayReviews: Click the "Connect Your Store" button or a similar button to establish a connection between your store and the BayReviews service.

Step 4: You'll be directed to a setup page where you'll need to provide additional information, including:

  • Basic Email Settings: Configure email-sending options.

  • Review Settings: Define how reviews are collected and displayed.

  • Look & Feel Settings: Customize the appearance of review widgets on your store.

Note💡: Once you complete the setup, you should receive your login credentials information through a popup and email to the registered account.

To Do:

After successfully installing the BayReviews app on your store, follow the below sections to set up your account:

Section 1 guides to place the integration script on your store page.

Section 2 allows to add the placeholder scripts at appropriate points to display the review widgets on your website.

Section 3 to import existing products and order details into your account.

Section 4 for API Endpoint scripts for Single/Bulk order creation/updation & API Endpoint for product creation/updation.

Section 5 explains the payload end results in BayReview UI.

Section 1: Custom Platform Integration with BayReviews Account

Note💡: Public key or Store-Access-Token is required to display reviews;

Public Key can be found in the following location in the app:

Settings -> Tools-> API Keys.

1.1 Steps to find the API settings in your BayReviews account:

1. Log into BayReviews app by entering the correct credentials. (https://app.targetbay.com/)

2. Once you're on the BayReviews dashboard, Click on the "Settings" icon located in the top right corner of the screen.

3. In the "Settings" menu, navigate to the “Tools” sections. Click on "API Keys.”

4. Under the "Data API" section, you can find the Public Key for your API authentication.

1.2 Script for displaying reviews on your website:

For integrating the BayReviews account with the custom platform for displaying reviews, the below script has to be placed on the store page.

Note💡:

  1. Place the scripts on all pages above the footer sections.

  2. On the product pages, the following variables should be filled in dynamically:
    productName

    productId

    productImageUrl

    productUrl

  3. The following variables should be filled in dynamically on the website:

    userId

    userMail

    userName

<script type="text/javascript">

(function() { window.tbConfig = {

platform: 'cp',

apiStatus: 'app',

apiVersion: 'v1',

apiUrl: 'https://app.targetbay.com/api/v1/webhooks/',

domain:'https://domain.com',

trackingType: '1',

productName: '',

productId: '',

productImageUrl: '',

productUrl: '',

userId: '',

userMail: '',

userName: 'anonymous',

userAvatar: '',

pageUrl: 'page-visit',

pageData: '',

orderId: '',

tbTrack: true,

tbInstagram: false,

tbRecommendations: false,

tbReview:

{

tbSiteReview: true,

tbProductReview: true,

tbBulkReview: true,

tbQa: true,

tbReviewBadge: false,

tbReviewPopup: false,

}

};

var sNew = document.scripts[0], gNew;gNew = document.createElement('script');gNew.src = 'https://' + tbConfig.apiStatus + '.targetbay.com/js/tb-track.js';gNew.type = 'text/javascript';gNew.async = true;sNew.parentNode.insertBefore(gNew, sNew);

})();

</script>

Here is a detailed explanation of the fields used in the above script:

  1. platform: 'cp', "Used by BayReviews as identification for the platform."

  2. apiStatus: 'app', - "Used to indicate the server type (production/staging)."

  3. apiVersion: 'v1', - "Used to indicate Targetbay API version."

  4. apiUrl: 'https://app.targetbay.com/api/v1/webhooks/', - "Webhooks url for data."

  5. domain:'https://domain.com', - "To verify the store domain URL"

  6. trackingType: '1', - "Used for event and UTM tracking. (default value as '1')."

  7. productName: - "For using in BayReview widget API."

  8. productId: - "This allows fetching the reviews for the particular product ID (accepts integer)."

  9. productImageUrl: - "For using in BayReview widget API."

  10. productUrl: - "For using in BayReview widget API"

  11. userId: - "Gets authenticated user id when user visits. Accepts integer value or empty."

  12. userMail: - "Gets User email id"

  13. userName: 'anonymous' - "Gets user name if provided during visits (default as anonymous)."

  14. userAvatar: - "Required for our product recommendation"

  15. pageUrl: 'page-visit - "Used for event and UTM tracking. (default as 'page-visit')"

  16. pageData: '', - "Used for event and UTM tracking."

  17. orderId: '', - "Gets the order id in the success page. Accepts integer"

  18. tbTrack: false, - "Used for tracking purpose in our legacy system"

  19. tbInstagram: false,- "For Instagram feature enable if true"

  20. tbRecommendations: false, - "For enabling product recommendation feature"

  21. tbReview:
    {

    tbSiteReview: true,

    tbProductReview: true,

    tbBulkReview: true,

    tbQa: true,

    tbReviewBadge: false,

    tbReviewPopup: false,

    }

    };
    - "For enabling individual features flag for BayReviews widget"
    var sNew = document.scripts[0], gNew;gNew = document.createElement('script');gNew.src = 'https://' + tbConfig.apiStatus + '.targetbay.com/js/tb-track.js';gNew.type = 'text/javascript';gNew.async = true;sNew.parentNode.insertBefore(gNew, sNew);

    })();

    </script>

Section 2: Display reviews at high conversion points on your website:

Integrate a BayReviews account with your custom platform to display reviews on your eCommerce stores.

2.1 Adding BayReviews Widget to your store

1. Adding Product Review Widget:

<div id="targetbay_reviews"></div>

This placeholder has to be placed on the product detail pages usually under the product description or above the footer sections.

2. Adding Site Review Widget:

<div id="targetbay_site_reviews"></div>

This placeholder has to be placed on all pages to display the floating widget as a sidebar.

3. Product Review Statistics:

<div class="product-name"></div>

This placeholder has to be placed on the product page below the product name.

4. Bulk Reviews (Review collection):

<div class="targetbay_star_container" id="xxxxx"></div>

(The ‘id’ has to be placed dynamically for the products)

This placeholder must be placed on the collection page below the product name.

Section 3: Import existing data through BayReviews via .CSV file

You can import existing products and orders from your eCommerce store via a .csv file while integrating with the BayReviews app.

3.1 Import Order

1. Log into the BayReviews app by entering the correct credentials. (https://app.targetbay.com/)

2. On the BayReviews dashboard, Click on the "Settings" icon located in the top right corner of the screen.

3. In the "Settings" menu, Navigate to the “Tools” sections. Click on "Import Orders" to import your orders.

4. Now browse for the .CSV file from your system and click on the option “Import.”

Note💡: Please find a sample CSV format available for download. The required fields for importing orders are order_id, customer_user_email, sku_1.

4.1 Order placement

  • Use the API endpoint below to sync the “Single/Bulk order,” order creation, and order update information from the store to BayReviews.

    Endpoint: https://api.reviews.targetbay.com/api/v2/order ​

  • Now, use the following Header Parameters:

    Store-Access-Token: As mentioned above, the store-access-token can be derived from your BayReviews app.

    Topic: If you are planning to create an order, use (orders/create), and for updating order info, use (orders/update)

    Method:
    Post

  • Here is the list of mandatory fields that you need to use to create a payload:

    order_id: This is the unique ID for the order placed
    email: Email ID of the user who placed the order
    order_status: Status of the order placed. Possible values are 'open' and 'completed.'
    created_date_time: Order created date time.
    updated_date_time: Order updated date time.
    product_id: Indicates the product id.

a) Single order:

Use this payload to sync single-order information on your store with BayReviews,


Payload:

[

{

"order_id": 201,

"email": "abc@domain.com",

"user_name": "ABC XYZ",

"first_name": "ABC",

"last_name": "XYZ",

"order_price": 123456,

"order_status": "open",

"created_date_time": "01-10-2024 00:00:00",

"updated_date_time": "01-10-2024 00:00:00",

"cart_items": [

{

"type": "simple",

"product_id": 2345,

"product_name": "Nike crew socks",

"price": 1150,

"special price": 1150,

"img_url": "https://example.com/3b4tre6op78mnnz2.jpg",

"quantity": 2

}

]

}

]

b) Bulk Order:

In case of bulk orders, copy the same format and add “,” then paste the same payload and make customizations like “order_id, email, user_name, first_name” etc.

Payload:

[

{

"order_id": 201,

"email": "abc@domain.com",

"user_name": "ABC XYZ",

"first_name": "ABC",

"last_name": "XYZ",

"order_price": 123456,

"order_status": "open",

"created_date_time": "01-10-2024 00:00:00",

"updated_date_time": "01-10-2024 00:00:00",

"cart_items": [

{

"type": "simple",

"product_id": 2345,

"product_name": "Nike crew socks",

"price": 1150,

"special price": 1150,

"img_url": "https://example.com/3b4tre6op78mnnz2.jpg",

"quantity": 2

},

{

"order_id": 198,

"email": "abc@domain.com",

"user_name": "ABC XYZ",

"first_name": "ABC",

"last_name": "XYZ",

"order_price": 123456,

"order_status": "open",

"created_date_time": "01-10-2024 00:00:00",

"updated_date_time": "01-10-2024 00:00:00",

"cart_items": [

{

"type": "simple",

"product_id": 2345,

"product_name": "TGB",

"price": 1150,

"special price": 1150,

"img_url": "https://example.com/3b4tre6op78mnnz2.jpg",

"quantity": 5

}

]

}

]

4.1.1 Verifying order sync within BayReviews

To verify if orders have been added to the BayReviews account, follow these instructions:

Step 1: On the BayReviews dashboard, move your cursor over the ‘three dots icon’ on the menu bar and select ‘Audience’ from the drop-down.

Step 2: Under Customer Tools, click on Orders:

Step 3: Under the Orders menu, you'll find a list of customers who have placed orders.



Step 4: To find a user and check if their order is verified, you can search for the user using the Order ID text box.



4.2 Product Create/Update

  • To sync the product updated or created information from the store to BayReviews. Use the below API Endpoint.

    Endpoint:https://api.reviews.targetbay.com/api/v2/product

  • Now, use the following Header Parameters:

    Store-Access-Token: As mentioned above, the store-access-token can be derived from your BayReviews app.

    Topic: If you are planning to create an order, use (products/create), and for updating order info, use (products/update)

    Method: Post

  • Here is the list of mandatory fields that you need to use to create a payload:

    product_id: This is the unique ID of the product. The product_id could be a string or integer.

    sku: Unique identifier assigned by the retailer to indicate stock

    ​name: Name of the product

    url_handle: The URL key of the product

    product_status: Status of the product. 1 indicates 'Active' products. 0 indicates 'Inactive' products.

    full_url: Full URL key of the product page

    image_url: Indicates the product image

  • Please use this Payload to create or update new product information:

    Payload:


    [
    {
    "product_id": 201,
    "sku": "123456ABCD",
    "name": "ABC XYZ",
    "url_handle": "test-products",
    "product_status": 1,
    "category": 35,
    "price": 499,
    "full_url": "https://example.com/products/test-products",
    "image_url": [
    {
    "url": "https://example.com/3b4tre6op78mnnz2.jpg"
    }
    ]
    }
    ]

4.2.1 Verify product addition with BayReviews:

After successfully executing the API Endpoints(product), you can verify whether your product has been added to the BayReviews account by following these instructions:

Step 1: Navigate to the settings section by clicking the settings icon.

Step 2: Under "Store Management," click the "Product" option. Here, you should be able to view a list of products that have been added to your BayReviews application.

4.3: API validation:

  • After creating the API endpoint, the following message will popup

202 Accepted {“accepted”:”ok”}
(Check the validation responses of the API in the Activity log located on the settings page under the API keys section).

  • To check whether the API has been validated, log in to BayReviews.

  • Then go to Setting in the top right corner.

  • Under the Tools menu, click on the API Keys.

  • Now, scroll down to access the Activity Logs. Under that, you can find the recently created API endpoints with title names.

  • If the API is validated, you can find the message Validation successful under the Activity Logs.

  • If the API validation is invalid, the error message will be displayed, highlighting errors.

Did this answer your question?