DEV Community

Cover image for How to Build a TikTok Shop Product Tracker (Find Winning Products)
Olamide Olaniyan
Olamide Olaniyan

Posted on

How to Build a TikTok Shop Product Tracker (Find Winning Products)

TikTok Shop is currently the biggest gold rush in e-commerce. Products go from zero to millions in sales overnight based on a single viral video.

If you are a dropshipper, an e-commerce brand, or an affiliate marketer, finding these "winning products" before the market gets saturated is the key to printing money.

In this tutorial, we'll build a Node.js script that tracks trending products on TikTok Shop, extracts their sales data, and helps you identify the next big winner.

The Challenge

TikTok's official API does not provide an easy way for third-party developers to scrape global product trends or sales volumes unless you are a registered seller managing your own store.

To get around this, we'll use the SociaVault API, which provides dedicated endpoints for extracting TikTok Shop data, including product details, sales volume, and pricing.

Prerequisites

  • Node.js installed
  • axios for making HTTP requests
  • A SociaVault API key (Get 1,000 free credits at sociavault.com)
npm init -y
npm install axios dotenv
Enter fullscreen mode Exit fullscreen mode

Step 1: Setting up the API Client

Create an index.js file and set up your environment variables.

require('dotenv').config();
const axios = require('axios');

const API_KEY = process.env.SOCIAVAULT_API_KEY;
const BASE_URL = 'https://api.sociavault.com/v1/tiktok/shop';

const headers = {
  'Authorization': `Bearer ${API_KEY}`,
  'Content-Type': 'application/json'
};
Enter fullscreen mode Exit fullscreen mode

Step 2: Searching for Products

Let's write a function that searches TikTok Shop for a specific keyword (e.g., "skincare", "tech gadget", "fitness") and retrieves the top products.

async function searchTikTokShop(keyword) {
  console.log(`Searching TikTok Shop for: "${keyword}"...`);

  try {
    const response = await axios.get(`${BASE_URL}/search`, {
      headers,
      params: {
        keyword: keyword,
        limit: 20 // Get top 20 products
      }
    });

    return response.data.data || [];
  } catch (error) {
    console.error('Error fetching products:', error.response?.data || error.message);
    return [];
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Analyzing the "Winning" Metrics

A winning product usually has:

  1. High sales volume.
  2. A healthy price point (usually $15 - $50 for impulse buys).
  3. Good ratings.

Let's process the raw data and calculate the estimated revenue for each product to find the true winners.

function analyzeProducts(products) {
  const analyzed = products.map(product => {
    // Extract price (assuming it comes as a string like "29.99")
    const price = parseFloat(product.price.replace(/[^0-9.-]+/g,""));
    const sales = parseInt(product.sales_volume) || 0;

    // Calculate estimated gross revenue
    const estimatedRevenue = price * sales;

    return {
      title: product.title,
      shopName: product.shop.name,
      price: `$${price.toFixed(2)}`,
      salesVolume: sales,
      estimatedRevenue: estimatedRevenue,
      rating: product.rating,
      url: product.url
    };
  });

  // Sort by highest estimated revenue
  return analyzed.sort((a, b) => b.estimatedRevenue - a.estimatedRevenue);
}
Enter fullscreen mode Exit fullscreen mode

Step 4: Putting it Together

Let's run the script and format the output so it's easy to read in the terminal.

async function runTracker() {
  const niches = ['viral gadget', 'gym equipment'];

  for (const niche of niches) {
    const products = await searchTikTokShop(niche);
    const winners = analyzeProducts(products);

    console.log(`\n=== TOP PRODUCTS FOR: ${niche.toUpperCase()} ===\n`);

    // Display the top 5 winners
    winners.slice(0, 5).forEach((product, index) => {
      console.log(`#${index + 1}: ${product.title.substring(0, 50)}...`);
      console.log(`Shop: ${product.shopName}`);
      console.log(`Price: ${product.price} | Sales: ${product.salesVolume.toLocaleString()}`);
      console.log(`Est. Revenue: $${product.estimatedRevenue.toLocaleString()}`);
      console.log(`Rating: ⭐ ${product.rating}`);
      console.log(`Link: ${product.url}`);
      console.log('-'.repeat(40));
    });
  }
}

runTracker();
Enter fullscreen mode Exit fullscreen mode

The Output

When you run node index.js, you'll get actionable e-commerce intelligence:

Searching TikTok Shop for: "viral gadget"...

=== TOP PRODUCTS FOR: VIRAL GADGET ===

#1: 3-in-1 Magnetic Wireless Charging Station...
Shop: TechHaven Official
Price: $24.99 | Sales: 145,200
Est. Revenue: $3,628,548
Rating: ⭐ 4.8
Link: https://shop.tiktok.com/view/product/...
----------------------------------------
#2: LED Desk Lamp with Wireless Charger...
Shop: GlowUp Home
Price: $19.50 | Sales: 89,000
Est. Revenue: $1,735,500
Rating: ⭐ 4.6
Link: https://shop.tiktok.com/view/product/...
----------------------------------------
Enter fullscreen mode Exit fullscreen mode

How to Monetize This Script

  1. For Dropshippers: Run this script daily on broad keywords to spot products that jump from 1,000 sales to 10,000 sales in a week. Source them on AliExpress and run your own ads.
  2. For Affiliates: Find high-converting products, buy them, and make your own TikTok videos linking to the shop to earn a commission.
  3. Build a SaaS: Wrap this script in a Next.js frontend, store the historical data in a database to show trend graphs, and charge e-commerce owners $49/mo for access.

Building this with Puppeteer or Playwright is a nightmare because TikTok heavily obfuscates their shop data and blocks headless browsers.

By using SociaVault, you get clean, structured JSON data instantly.

Get your free API key at SociaVault.com and start finding winning products today.

Top comments (0)