# Install TasteRay ForMe ("Is This For Me?" Widget)

> Add TasteRay ForMe to any product or media page in two steps. No build tools, no signup, no API key.
> Canonical HTML page: https://forme.tasteray.com/install

## Step 1: Add the script

Include the widget script before your closing `</body>` tag:

```html
<script src="https://forme.tasteray.com/widget.js" defer></script>
```

## Step 2: Add a button or container element

```html
<button
  data-tasteray-feature="for-me"
  data-tasteray-title="Your Product Name"
  data-tasteray-medium="product"
  data-tasteray-description="A brief description of the product..."
  data-tasteray-lang="en"
>Is this for me?</button>
```

The widget mounts its modal UI inside Shadow DOM and handles the conversation, match verdict, and alternatives automatically.

## Data attributes reference

| Attribute | Required | Description |
|---|---|---|
| `data-tasteray-feature` | Yes | Must be `"for-me"` to activate the widget. |
| `data-tasteray-title` | Yes | Product or media name. |
| `data-tasteray-medium` | Yes | What you are selling. Any non-empty text (e.g., `product`, `movie`, `book`, `board-game`). Missing or empty values cause the chat request to return `400`. |
| `data-tasteray-description` | Recommended | Brief description (100+ chars recommended). If short or missing, the widget can scrape from `data-tasteray-url`. |
| `data-tasteray-lang` | No | Widget language: `en` or `pl`. Auto-detected from the page if omitted. |
| `data-tasteray-year` | No | Release or publication year (useful for movies, books, games; omit for physical products). |
| `data-tasteray-url` | No | Canonical product URL for automatic description scraping. |

## Documented `data-tasteray-medium` values

Any non-empty text works. Documented values:

- `product` — physical products, electronics, fashion, gear
- `movie` — movies
- `tv-series` — TV series
- `documentary` — documentaries
- `computer-game` — video games
- `book` — books and publications
- `album` — music albums and EPs
- `podcast` — podcasts
- `artist` — musicians and bands
- `concert` — live shows and tours

## Shopify Liquid (`sections/main-product.liquid`)

Load `<script src="https://forme.tasteray.com/widget.js" defer></script>` once in `layout/theme.liquid`, then paste below your Add to Cart form:

```liquid
<div
  data-tasteray-feature="for-me"
  data-tasteray-title="{{ product.title | escape }}"
  data-tasteray-medium="product"
  data-tasteray-description="{{ product.description | strip_html | truncate: 500 | escape }}"
  data-tasteray-url="{{ shop.url }}{{ product.url }}"
  data-tasteray-lang="en"
></div>
```

## React / JSX example

```tsx
import { useEffect } from 'react';

export function ForMeButton({ title, description }: { title: string; description?: string }) {
  useEffect(() => {
    const s = document.createElement('script');
    s.src = 'https://forme.tasteray.com/widget.js';
    s.defer = true;
    document.body.appendChild(s);
    return () => s.remove();
  }, []);

  return (
    <button
      data-tasteray-feature="for-me"
      data-tasteray-title={title}
      data-tasteray-medium="product"
      data-tasteray-description={description}
    >
      Is this for me?
    </button>
  );
}
```

## Limits & rate limiting

- Chat endpoint rate limit: **10 requests per minute per IP**.
- Conversation length: ~5 tailored psychographic questions followed by an honest match score, explanation, and alternatives.
- For server-side catalog ranking and custom rows, use **TasteRay Business - Recommendation API** ([api.tasteray.com/docs.md](https://api.tasteray.com/docs.md)), `@tasteray/business-mcp` ([github.com/tasteray/business-mcp](https://github.com/tasteray/business-mcp)), or [github.com/tasteray/business-api-examples](https://github.com/tasteray/business-api-examples).
