> ## Documentation Index
> Fetch the complete documentation index at: https://docs.replit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Collect reviews and ratings

> Prompt happy players to rate PixelGames using each store's native review prompt.

export const PromptActions = ({prompt = "", campaign = "docs-prompt-actions"}) => {
  const LZ_SRC = "https://cdnjs.cloudflare.com/ajax/libs/lz-string/1.5.0/lz-string.min.js";
  const ensureLZString = () => {
    if (typeof document === "undefined") return;
    if (window.LZString) return;
    if (document.querySelector(`script[src="${LZ_SRC}"]`)) return;
    const s = document.createElement("script");
    s.src = LZ_SRC;
    s.async = true;
    document.head.appendChild(s);
  };
  const handleCopy = async e => {
    const btn = e.currentTarget;
    if (!prompt) return;
    try {
      await navigator.clipboard.writeText(prompt);
    } catch {
      const ta = document.createElement("textarea");
      ta.value = prompt;
      document.body.appendChild(ta);
      ta.select();
      try {
        document.execCommand("copy");
      } catch {}
      document.body.removeChild(ta);
    }
    const original = btn.dataset.label || btn.innerText;
    btn.dataset.label = original;
    btn.innerText = "Copied!";
    setTimeout(() => {
      if (btn.isConnected) btn.innerText = original;
    }, 1500);
  };
  const handleBuild = () => {
    if (!prompt || typeof window === "undefined") return;
    const utm = `utm_source=replit-docs&utm_medium=docs&utm_campaign=${encodeURIComponent(campaign)}&utm_content=prompt-actions`;
    let url;
    if (window.LZString) {
      const encoded = window.LZString.compressToEncodedURIComponent(prompt);
      url = `https://replit.com/?prompt=${encoded}&referrer=replit-docs&${utm}`;
    } else {
      url = `https://replit.com/?prompt=${encodeURIComponent(prompt)}&referrer=replit-docs&${utm}`;
    }
    window.open(url, "_blank", "noopener,noreferrer");
  };
  ensureLZString();
  const baseButtonStyle = {
    display: "inline-flex",
    alignItems: "center",
    gap: "6px",
    padding: "8px 16px",
    borderRadius: "8px",
    fontSize: "14px",
    fontWeight: 500,
    cursor: "pointer",
    lineHeight: 1.2,
    fontFamily: "inherit",
    textDecoration: "none"
  };
  return <div style={{
    display: "flex",
    gap: "12px",
    margin: "16px 0",
    flexWrap: "wrap",
    alignItems: "center"
  }}>
      <button type="button" onClick={handleCopy} style={{
    ...baseButtonStyle,
    background: "transparent",
    color: "inherit",
    border: "1px solid rgba(127,127,127,0.4)"
  }}>
        Copy the prompt
      </button>
      <button type="button" onClick={handleBuild} style={{
    ...baseButtonStyle,
    background: "#F26207",
    color: "#FFFFFF",
    border: "1px solid #F26207"
  }}>
        Build on Replit ↗
      </button>
    </div>;
};

export const AiPrompt = ({children}) => {
  return <CodeBlock className="relative block font-sans whitespace-pre-wrap break-words">
      <div className="pr-7">
        {children}
      </div>
    </CodeBlock>;
};

export const reviewPrompt = "Ask players to rate PixelGames using the native review prompt right after they set a new high score in Blocks.";

More ratings help your app rank higher and build trust with new users. Both stores have a
native prompt for this: a popup asking for a rating right inside the app.

## Ask for a review at the right moment

Ask for a review after a win, a new high score, or a level up. The moment matters more than
how often you ask.

<AiPrompt>
  {reviewPrompt}
</AiPrompt>

<PromptActions prompt={reviewPrompt} campaign="docs-mobile-collect-reviews" />

<Frame caption="PixelGames' Game Over screen after a new high score, the ideal moment to ask for a rating.">
  <img src="https://mintcdn.com/replit/wpDFPJulnZRpqmW6/images/pixelgames/mobile/rate-app.webp?fit=max&auto=format&n=wpDFPJulnZRpqmW6&q=85&s=a08c9182d0cbc933234c8cabb4ca4ab8" alt="PixelGames Game Over screen showing a new high score" data-path="images/pixelgames/mobile/rate-app.webp" width="1516" height="852" data-path="images/pixelgames/mobile/rate-app.webp" />
</Frame>

StoreKit on iOS, Google Play's In-App Review API on Android, both cap how often it actually
shows, regardless of how often your code asks.

<Note>
  Never bribe or require a rating, like unlocking a game only after rating 5 stars. Apple and
  Google both prohibit incentivized reviews, and PixelGames can be rejected or removed for it.
</Note>

## Troubleshooting

* **Prompt never appears:** expected sometimes, both platforms cap how often the system shows
  it regardless of how many times your code calls the API.
* **Prompt shows every time in testing:** normal on a TestFlight or Internal Testing build,
  the yearly rate limit only applies to real production installs.
* **Players complain about being asked too often:** confirm you're calling the native API and
  not a custom popup shown on every launch, that bypasses the built-in rate limiting.

## What's next

<CardGroup cols={2}>
  <Card title="Add payments" icon="credit-card" href="/build/mobile-payments">
    Charge players for content in PixelGames.
  </Card>
</CardGroup>

## Related

* [Submit to the App Store](/build/mobile-publish-ios)
* [Submit to Google Play](/build/mobile-publish-android)
