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

# JavaScript Snippets

> Advanced tracking and customization

# JavaScript Snippets

PayRequest doesn't have a general-purpose custom JavaScript field (no place to paste in Google Analytics, Meta Pixel, or a custom tracking script that runs on your shop or payment pages). What does exist today is a copy-paste **embed snippet** for Smart Links, which puts a "buy button" on your own website.

<Info>
  If you're looking for third-party analytics/tracking injection on your PayRequest Page or shop, that isn't available yet. This page covers the embeddable Smart Link button, which is the closest existing feature.
</Info>

## Embeddable Buy Buttons

Every [Smart Link](/payment-processing/smart-links) can generate an embed snippet — a small HTML block (a stylesheet link plus a styled `<a>` button) that you paste into your own website to link straight to that Smart Link's checkout.

<Steps>
  <Step title="Open a Smart Link">
    Go to **Smart Links**, and open the one you want to embed.
  </Step>

  <Step title="Find the embed section">
    Scroll to **Embed button on your website**.
  </Step>

  <Step title="Pick a style">
    Choose between **Default**, **Dark**, or **Outline** button styles.
  </Step>

  <Step title="Copy the snippet">
    Click to copy — it's a `<link>` tag pulling PayRequest's button stylesheet plus an `<a>` tag styled as a button, linking to your Smart Link URL.
  </Step>

  <Step title="Paste it into your site">
    Drop the snippet into your website's HTML wherever you want the buy button to appear.
  </Step>
</Steps>

<Note>
  This is a plain HTML link styled as a button — there's no JavaScript to configure, and nothing to maintain beyond pasting the snippet once. If you change the Smart Link's price or product later, the embedded button keeps working since it just links to the Smart Link URL.
</Note>

## Tracking Conversions Elsewhere

Since there's no native pixel/analytics field, two practical options if you need to track conversions from PayRequest payments on your own site or ad platform:

* **Webhooks**: Use the [`payment.succeeded` webhook](/organization-and-automation/webhook-configuration) to fire your own server-side conversion event when a payment completes.
* **On-success redirect**: Some Smart Link configurations support an on-success action/URL — if yours redirects to a page on your own domain after payment, you can place tracking scripts on that landing page itself.

## FAQ

<AccordionGroup>
  <Accordion title="Can I add Google Analytics or a Facebook Pixel to my PayRequest Page?">
    Not as a built-in settings field today. The most reliable way to track conversions is the `payment.succeeded` webhook, handled server-side.
  </Accordion>

  <Accordion title="Is the embed snippet just a link, or does it load a script?">
    It's a stylesheet link plus a plain HTML button/link — no JavaScript executes on your page beyond what your own site already runs.
  </Accordion>

  <Accordion title="Can I customize the embed button's colors beyond the three preset styles?">
    Not currently — Default, Dark, and Outline are the available styles.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Smart Links" icon="link" href="/payment-processing/smart-links">
    Create and manage the links you can embed
  </Card>

  <Card title="Webhook Configuration" icon="webhook" href="/organization-and-automation/webhook-configuration">
    Track payments server-side instead of client-side
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.