Building a Python Tool for Amazon Competitor Feature Analysis with SellerMagnetAPI
In today's competitive e-commerce landscape, understanding your competitors on Amazon is crucial for success. Analyzing their product features, pricing strategies, and customer reviews can provide valuable insights for optimizing your own listings and gaining a competitive edge. This blog post will guide you through building a Python tool that leverages the SellerMagnet API to automate Amazon competitor feature analysis, enabling data-driven decision-making for inventory management, market research, and overall business strategy.
SellerMagnet API provides enterprise-grade Amazon data, empowering businesses with the tools they need to thrive. This post demonstrates how to use the SellerMagnet API to build a solution for Amazon businesses and market analysts.
Why Use SellerMagnet API for Competitor Analysis?
SellerMagnet API offers several advantages for Amazon competitor analysis:
- Comprehensive Data: Access a wide range of product data, including pricing, sales rank, reviews, and product features.
- Real-time Information: Get up-to-date information to stay ahead of market trends.
- Scalability: Handle large volumes of data efficiently, allowing you to analyze multiple competitors simultaneously.
- Ease of Integration: Simple and intuitive API design facilitates seamless integration into your existing workflows.
Setting Up Your Python Environment
Before we start building our tool, let's set up the Python environment. Ensure you have Python installed. Then, install the 'requests' library, which we'll use to make HTTP requests to the SellerMagnet API.
pip install requests
Practical Use Cases and Examples
Let's dive into some practical use cases and code examples demonstrating how to utilize the SellerMagnet API for competitor feature analysis.
1. Retrieving Product Information
First, we can use the Amazon Product Lookup endpoint to gather information about competitor products, such as features, descriptions, and dimensions.
import requests
api_key = "YOUR_API_KEY"
marketplace_id = "ATVPDKIKX0DER" # Amazon.com
asin = "B08N5WRWNW" # Example ASIN
url = f"https://sellermagnet-api.com/amazon-product-lookup?api_key={api_key}&marketplaceId={marketplace_id}&asin={asin}"
response = requests.get(url)
data = response.json()
if data["success"]:
product_info = data["data"]["productInfo"]
print(f"Product Title: {product_info['title']}")
print(f"Description: {product_info['description'][:2]}...") #First two descriptions only
print(f"Features: {product_info['bulletPoints'][:3]}...") #First three bulletpoints only
else:
print("Error retrieving product information:", data)
Response Example:
{
"data": {
"productInfo": {
"additionalDetails": {
"ASIN": "B08N5WRWNW",
"Batteries": "1 Lithium Ion batteries required. (included)",
"Best Sellers Rank": "#1 in Video Games",
"Customer Rating": "4.7 out of 5 stars",
"Date First Available": "November 12, 2020",
"Item Weight": "10.6 pounds",
"Item model number": "CFI-1015A",
"Manufacturer": "Sony",
"Number of Reviews": "7,092 ratings",
"Product Dimensions": "14 x 17 x 7 inches; 10.6 Pounds",
"Release date": "November 12, 2020",
"Type of item": "Video Game"
},
"asin": "B08N5WRWNW",
"bestsellerRanks": {
"main_category": {
"name": "Video Games",
"rank": 1
},
"subcategory": {
"name": "PlayStation 5 Consoles",
"rank": 1
}
},
"bulletPoints": [
"Model Number CFI-1000A",
"Includes DualSense Wireless Controller, 1TB SSD, Base",
"Lightning Speed - Harness the power of a custom CPU, GPU, and SSD with Integrated I/O that rewrite the rules of what a PlayStation console can do."
],
"buyBoxInfo": {
"currencyCode": "USD",
"currencyName": "United States Dollar",
"currencySymbol": "$",
"price": 499.99,
"sellerId": "A2L77EE7U5DJEA"
},
"categories": {
"bestsellerCategory": [
{
"id": "20972781011",
"index": 1,
"name": "PlayStation 5",
"url": "https://www.amazon.com/b/ref=dp_bc_2?ie=UTF8&node=20972781011"
},
{
"id": "20972796011",
"index": 2,
"name": "Consoles",
"url": "https://www.amazon.com/b/ref=dp_bc_3?ie=UTF8&node=20972796011"
}
],
"rootCategory": {
"id": "468642",
"name": "Video Games",
"url": "https://www.amazon.com/computer-video-games-hardware-accessories/b/ref=dp_bc_1?ie=UTF8&node=468642"
}
},
"description": [
"Model Number CFI-1000A",
"Includes DualSense Wireless Controller, 1TB SSD, Base",
"Lightning Speed - Harness the power of a custom CPU, GPU, and SSD with Integrated I/O that rewrite the rules of what a PlayStation console can do.",
"Stunning Games - Marvel at incredible graphics and experience new PS5 features.",
"Breathtaking Immersion - Discover a deeper gaming experience with support for haptic feedback, adaptive triggers, and 3D Audio technology."
],
"details": {
"ASIN": "B08N5WRWNW",
"Batteries": "1 Lithium Ion batteries required. (included)",
"Date First Available": "November 12, 2020",
"Item Weight": "10.6 pounds",
"Item model number": "CFI-1015A",
"Manufacturer": "Sony",
"Platform": "PlayStation 5",
"Product Dimensions": "14 x 17 x 7 inches; 10.6 Pounds",
"Release date": "November 12, 2020",
"Type of item": "Video Game"
},
"hasAPlusContent": true,
"images": [
"https://m.media-amazon.com/images/I/510VSfnhjZL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/61Rr0Kj3YWL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/51o7I36xjiL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/61QXYBXYRHL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/51fM0CKG+HL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/51Ju0vfrdxL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/61qbq+iOiHL._AC_UY218_.jpg",
"https://m.media-amazon.com/images/I/51Eql33lG3L._AC_UY218_.jpg"
],
"link": "https://www.amazon.com/dp/B08N5WRWNW",
"listedSinceDate": "2020-11-12",
"mainImage": "https://m.media-amazon.com/images/I/510VSfnhjZL.jpg",
"marketplaceId": "ATVPDKIKX0DER",
"reviews": {
"averageRating": 4.7,
"reviewSummary": "4.7 out of 5 stars",
"totalReviews": 7092
},
"title": "PlayStation 5 Console",
"variations": [
{
"asin": "B09N5R8CQW",
"attributes": {
"Color": "Horizon Forbidden West Bundle"
}
},
{
"asin": "B09N5TK2TF",
"attributes": {
"Color": "Ratchet & Clank: Rift Apart Bundle"
}
}
],
"videos": [
"https://m.media-amazon.com/images/I/M4PFFC3W08.mp4",
"https://m.media-amazon.com/images/I/M45YMH879J.mp4"
]
}
},
"success": true
}
This code snippet retrieves the product title, description, and key features of a competitor's product using its ASIN. These details are essential for understanding their offerings and identifying potential areas for differentiation.
2. Monitoring Pricing and Offers
Tracking competitor pricing is vital for maintaining competitive pricing strategies. The Amazon Product Offers endpoint provides detailed pricing information, including the Buy Box price and available offers.
import requests
api_key = "YOUR_API_KEY"
marketplace_id = "ATVPDKIKX0DER" # Amazon.com
asin = "B08N5WRWNW" # Example ASIN
url = f"https://sellermagnet-api.com/amazon-product-offers?api_key={api_key}&marketplaceId={marketplace_id}&asin={asin}"
response = requests.get(url)
data = response.json()
if data["success"]:
offers = data["data"]["offers"]
buy_box = data["data"]["buyBox"]
print(f"Buy Box Price: {buy_box['totalPrice']} {data['data']['currency']['symbol']}")
print("Available Offers:")
for offer in offers[:3]: # Print first 3 offers
print(f" - Seller: {offer['sellerName']}, Price: {offer['totalPrice']} {data['data']['currency']['symbol']}, Condition: {offer['condition']}")
else:
print("Error retrieving product offers:", data)
Response Example:
{
"data": {
"asin": "B08N5WRWNW",
"buyBox": {
"condition": "New",
"deliveryDate": "2024-07-05",
"fulfillmentType": "FBA",
"inventory": 30,
"positivePercentage": 0,
"priceWithoutShipping": 499.99,
"sellerId": "Amazon",
"sellerName": "Amazon",
"shippingPrice": 0,
"totalPrice": 499.99,
"totalReviews": 0
},
"currency": {
"code": "USD",
"name": "United States Dollar",
"symbol": "$"
},
"marketplaceId": "ATVPDKIKX0DER",
"offers": [
{
"condition": "New",
"deliveryDate": "2024-07-05",
"fulfillmentType": "FBA",
"inventory": 30,
"positivePercentage": 0,
"priceWithoutShipping": 499.99,
"sellerId": "Amazon",
"sellerName": "Amazon",
"shippingPrice": 0,
"totalPrice": 499.99,
"totalReviews": 0
},
{
"condition": "Used - Like New",
"deliveryDate": "2024-07-08",
"fulfillmentType": "FBM",
"inventory": 1,
"positivePercentage": 97,
"priceWithoutShipping": 455.00,
"sellerId": "A2L77EE7U5DJEA",
"sellerName": "Electronics Valley",
"shippingPrice": 0,
"totalPrice": 455.00,
"totalReviews": 1537
},
{
"condition": "Used - Very Good",
"deliveryDate": "2024-07-09",
"fulfillmentType": "FBM",
"inventory": 1,
"positivePercentage": 97,
"priceWithoutShipping": 450.00,
"sellerId": "A2L77EE7U5DJEA",
"sellerName": "Electronics Valley",
"shippingPrice": 9.99,
"totalPrice": 459.99,
"totalReviews": 1537
}
],
"productLink": "https://www.amazon.com/dp/B08N5WRWNW",
"productMainImage": "https://m.media-amazon.com/images/I/510VSfnhjZL.jpg",
"productTitle": "PlayStation 5 Console"
},
"success": true
}
This snippet fetches the Buy Box price and a list of available offers, including seller information and pricing. Monitoring these offers helps in dynamically adjusting pricing strategies to remain competitive.
3. Tracking Product Statistics Over Time
Understanding historical sales rank and pricing trends is essential for identifying seasonality and long-term performance. Use the Amazon Product Statistics endpoint to retrieve this historical data.
import requests
api_key = "YOUR_API_KEY"
marketplace_id = "ATVPDKIKX0DER" # Amazon.com
asin = "B08N5WRWNW" # Example ASIN
url = f"https://sellermagnet-api.com/amazon-product-statistics?api_key={api_key}&marketplaceId={marketplace_id}&asin={asin}"
response = requests.get(url)
data = response.json()
if data["success"]:
sales_rank_history = data["data"]["salesRankHistory"]
print("Sales Rank History (Last 5):")
for rank in sales_rank_history[-5:]:
print(f" - Date: {rank[0]}, Rank: {rank[1]}")
buy_box_history = data["data"]["buyBoxSellerIdHistory"]
print("\nBuy Box Seller History (Last 5):")
for seller in buy_box_history[-5:]:
print(f" - Date: {seller[0]}, Seller: {seller[1]}")
else:
print("Error retrieving product statistics:", data)
Response Example:
{
"success": true,
"data": {
"asin": "B08N5WRWNW",
"amazonPrice": 49999,
"bestSellerRank": 1,
"buyBoxPrice": 49999,
"buyBoxFulfillment": "AMZ",
"buyBoxSellerIdHistory": [
["2024-06-24T00:00:00", "A2L77EE7U5DJEA"],
["2024-06-25T00:00:00", "Amazon"]
],
"salesRankHistory": [
["2024-06-24T00:00:00", 1],
["2024-06-25T00:00:00", 1]
],
"trackingSince": "2024-06-24"
}
}
This code retrieves the sales rank history and Buy Box seller history, allowing you to analyze trends and patterns over time. This information can inform inventory management and promotional strategies.
4. Analyzing Seller Reviews
Understanding a competitor’s reputation can provide insights into customer satisfaction and potential weaknesses. The Amazon Seller Review endpoint provides access to seller feedback and recent reviews.
import requests
api_key = "YOUR_API_KEY"
marketplace_id = "ATVPDKIKX0DER" # Amazon.com
seller_id = "A2L77EE7U5DJEA" # Example Seller ID
url = f"https://sellermagnet-api.com/amazon-seller-review?api_key={api_key}&marketplaceId={marketplace_id}&sellerId={seller_id}"
response = requests.get(url)
data = response.json()
if data["success"]:
seller_feedback = data["data"]["marketplace"]["ATVPDKIKX0DER"]["sellerFeedback"]
last_5_reviews = data["data"]["marketplace"]["ATVPDKIKX0DER"]["last5Reviews"]
print("Seller Feedback (30 days):")
print(f" - Rating: {seller_feedback['30']['rating']}, Reviews: {seller_feedback['30']['reviewsCount']}\n")
print("Last 5 Reviews:")
for review in last_5_reviews:
print(f" - Date: {review['dateRated']}, Rating: {review['starRating']}, Review: {review['reviewText'][:50]}...")
else:
print("Error retrieving seller reviews:", data)
Response Example:
{
"data": {
"marketplace": {
"ATVPDKIKX0DER": {
"last5Reviews": [
{
"dateRated": "By A. Smith on June 24, 2024",
"reviewText": "Great product, fast shipping!",
"starRating": "5 out of 5 stars"
},
{
"dateRated": "By J. Doe on June 23, 2024",
"reviewText": "Excellent service and product quality.",
"starRating": "5 out of 5 stars"
}
],
"sellerFeedback": {
"30": {
"rating": "4.9",
"reviewsCount": "25"
},
"90": {
"rating": "4.8",
"reviewsCount": "75"
},
"365": {
"rating": "4.7",
"reviewsCount": "300"
},
"lifetime": {
"rating": "4.6",
"reviewsCount": "1,200"
}
}
},
"sellerId": "A2L77EE7U5DJEA"
},
"success": true
}
This snippet fetches recent seller reviews and overall feedback ratings, helping you assess their reputation and identify potential customer pain points that you can address.
Building the Competitor Analysis Tool
Now, let’s consolidate these individual tasks into a more comprehensive competitor analysis tool. We can create a Python class to encapsulate these functions and provide a streamlined interface.
import requests
class AmazonCompetitorAnalysis:
def __init__(self, api_key, marketplace_id):
self.api_key = api_key
self.marketplace_id = marketplace_id
self.base_url = "https://sellermagnet-api.com"
def get_product_info(self, asin):
url = f"{self.base_url}/amazon-product-lookup?api_key={self.api_key}&marketplaceId={self.marketplace_id}&asin={asin}"
response = requests.get(url)
data = response.json()
return data
def get_product_offers(self, asin):
url = f"{self.base_url}/amazon-product-offers?api_key={self.api_key}&marketplaceId={self.marketplace_id}&asin={asin}"
response = requests.get(url)
data = response.json()
return data
def get_product_statistics(self, asin):
url = f"{self.base_url}/amazon-product-statistics?api_key={self.api_key}&marketplaceId={self.marketplace_id}&asin={asin}"
response = requests.get(url)
data = response.json()
return data
def get_seller_reviews(self, seller_id):
url = f"{self.base_url}/amazon-seller-review?api_key={self.api_key}&marketplaceId={self.marketplace_id}&sellerId={seller_id}"
response = requests.get(url)
data = response.json()
return data
# Example Usage
api_key = "YOUR_API_KEY"
marketplace_id = "ATVPDKIKX0DER" # Amazon.com
asin = "B08N5WRWNW" # Example ASIN
seller_id = "A2L77EE7U5DJEA" # Example Seller ID
analysis_tool = AmazonCompetitorAnalysis(api_key, marketplace_id)
product_info = analysis_tool.get_product_info(asin)
if product_info["success"]:
print("Product Info:", product_info["data"]["productInfo"]["title"])
product_offers = analysis_tool.get_product_offers(asin)
if product_offers["success"]:
print("\nBuy Box Price:", product_offers["data"]["buyBox"]["totalPrice"])
product_stats = analysis_tool.get_product_statistics(asin)
if product_stats["success"]:
print("\nSales Rank:", product_stats["data"]["bestSellerRank"])
seller_reviews = analysis_tool.get_seller_reviews(seller_id)
if seller_reviews["success"]:
print("\nSeller Rating (30 days):",