Join Free
+ Reply to Thread
Results 1 to 5 of 5
  1. #1

    Need clarification

    I see how we can get data (commissions, clicks) for a particular merchant or product within a time period, but I don't see how this equates to a 'trend'.

    For example I found this on the forum:

    top 15 products, last 30 days:
    // set number of days
    $numDays = 30;

    // set number of products
    $numProducts = 15;

    // fetch trends from api
    $api = new Prosperent_Api();
    $api->setDateRange('commission', date('Ymd', time() - 86400 * $numDays), date('Ymd'))

    // get array of products
    $products = array_slice($api->getFacets('productId'), 0, $numProducts);

    // set productId as array key
    $dataset = array();
    foreach ($products as $i => $product)


    I don't see how this code identifies 'top' products, since it isn't sorting it. Are the results from trend queries already sorted in some way? I just can't figure this out..sorry.

  2. #2
    The trends endpoint is giving you direct access to our commission system. The products returned are those that have actual sales over the period. You can then group by count, sort, or whatever to identify the top sellers, but by default, it returns products with sales in the defined time period.

  3. #3
    Please bear with me Brian. It's bound to 'click' with me soon! ..

    I just ran this:

    $daterange = date('Ymd', time() - 86400 * 30) . "," . date('Ymd');

    echo " daterange is $daterange ";
    $url = "$apikey&commissionDateRange=$datera nge&filterMerchant=$merchstr";

    I printed out the facets for productId and merchant:

    facets key is merchant
    value is Array ( [0] => Array ( [count] => 1950 [value] => [extendedFieldValue] => zappos com ) [1] => Array ( [count] => 476 [value] => Kohls [extendedFieldValue] => kohls ) )

    Zappos shows a count of 1950 and Kohls of 476. What are those and how do those relate to commissions?

    facets key is productId
    value is Array ( [0] => Array ( [count] => 1748 [value] => [extendedFieldValue] => ) [1] => Array ( [count] => 3 [value] => b9b44efce63dce62bb11cd6725d220a2 [extendedFieldValue] => b9b44efce63dce62bb11cd6725d220a2 ) [2] => Array ( [count] => 2 [value] => 7d8032d296945f3cf42cfb6202e52be7 [extendedFieldValue] => 7d8032d296945f3cf42cfb6202e52be7 ) [3] => Array ( [count] => 2 [value] => 872bce935c846a48f6cbc7cb307777da [extendedFieldValue] => 872bce935c846a48f6cbc7cb307777da ) [4] => Array ( [count] => 2 [value] =>


    The productId facet first 4 products show counts of 3,2,2, and 2. What are those, and how do those relate to commissions?

    How can I know which productsIds are for Zappos, and which are for Kohls when I have run a filter using both of them?

    I don't know how to use the raw data because I don't know what it actually represents -- ie, how to identify a 'top' seller and tie it to either Zappos or Kohls. Once I have a top product tied to the merchant then there is no problem getting the info on it, of course. THanks for your patience with me.
    Last edited by tedm; 03-17-2014 at 12:34 PM.

  4. #4
    The counts are sales. The Zappos count is the number of sales in that time period, and the count in the productId facet is the number of sales for that productId. When you send the productId to the US Catalog, you will get back the full product data including the merchant and such. My free search script shows how to query the trends endpoint and send that data to the catalog to pull back an actual product. It may help to take a look at that code to get an idea of how it works.

  5. #5
    I looked at and ran your search script (changed the date range and made Keyword '*shoes*', and got results. This appears to me to pull 100 different shoe productIDs from trends, meaning for shoes that have sales, and then finding the info(image,etc) and merchants associated with them in the product endpoint. In trends, I can look at the count for each productID (I think) to get the top selling productIDs also.

    I see how we can use trends to identify top selling products and get a list to then use for 1 query of the product endpoint. I see also how we can get all products or coupons for a given merchant with 1 query using the product or coupon endpoint.

    What I don't see is how to get the top selling product for Zappos and a different top selling product for Kohls without doing 2 queries of the trends endpoint.

    Maybe it is best to focus only on the products and not the merchants, but since certain merchants have pulling power, I thought I would highlight them and their hottest selling product on my 'popular' page.

    Another example I found on the forum to get the top product for a given merchant only has one merchant..

    So going back to my original question on the other thread, I maybe didn't state it correctly: If each of 50 merchants have a top selling product that is unique to them, then is there a way to identify that with just one query, or will I have to run a separate query on trends for each one?
    Any further insight appreciated !

    EDIT: It occurs to me that I can run a trends to get all of the top selling products (filterKeyword=*) and then get the merchants associated with them at the products endpoint, and THEN I can match the merchants with my list of 'popular' merchants to list their hot products. That requires only 2 API queries and php matching of arrays on my end. Does that sound like the way to go?

    Lastly, Is there a limit on the productId results from trends? It seems to be capped at 100, but I didn't see that as a variable that is set and putting in limit => 1000 didn't make a difference..
    Last edited by tedm; 03-17-2014 at 02:52 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
coupons | coupons and deals