Set up SourceTrack with an AI site builder
Copy-paste prompts that tell Lovable, Bolt, Replit or v0 to add the SourceTrack script to your site, and optionally to record conversions.
Before you start
- Open Setup & Health in SourceTrack (https://app.sourcetrack.ai/setup) and find your site key in your snippet, under Install the script. It is the value after
data-site-key. - Only your site key goes into the builder chat. Never paste an API token (it starts with
st_live_). The builder does not need one.
What the prompt adds
One script tag, which loads SourceTrack on every page of your site:
<script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>
If your site uses a custom tracking domain, copy the snippet from Setup & Health instead. It already points at the right address.
Prompts
Replace PASTE_YOUR_SITE_KEY_HERE with your site key, then paste the prompt into the builder's chat. The same text works in every builder, because each prompt asks the builder to work out what kind of project it is.
Lovable
Paste this into the Lovable chat after replacing PASTE_YOUR_SITE_KEY_HERE with your site key:
Add SourceTrack analytics to this Lovable project.
My SourceTrack site key is: PASTE_YOUR_SITE_KEY_HERE
This is a PUBLIC site key. It is meant to appear in the page source. Use only this value.
Do exactly this:
1. Work out what kind of project this is.
- Plain HTML, or a Vite or other single-page app with an index.html: add this one tag inside the <head> of index.html:
<script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>
- Next.js App Router: in app/layout.tsx add this inside <body>, after {children}:
<Script src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY" strategy="afterInteractive" />
and import Script from "next/script".
- Anything else: put the same script tag in the single HTML shell that every page shares.
2. Replace YOUR_SITE_KEY with my site key. Keep the src URL and the attribute names exactly as written. Add the tag in one place only, once.
3. Do not add cookies, a consent banner, or any other tracking code.
4. Do not ask me for, and never use, any server API token or secret key (anything starting with st_live_). Do not put a token in the code, in an environment variable, or in this chat. Only the public site key belongs in the browser.
5. Tell me which file you changed.
When you are done, I will publish, open my live site on the domain I registered in SourceTrack, and check that a request to /api/track completes.
Optional, to send conversions. Paste this as a second message:
Now send conversions to SourceTrack from this Lovable project. The tracking script is already installed.
Call window.sourcetrack.conversion(...) only after the action has really succeeded (the signup is saved, the form is accepted, the payment is confirmed), and guard it because the script loads asynchronously:
if (window.sourcetrack) {
window.sourcetrack.conversion({ type: 'lead' })
}
- Lead or signup: type "lead" or "signup". Send no value.
- Purchase: type "purchase", with order_id set to the real order or payment id, value set to the real amount, and currency set to its three-letter code. Never invent or estimate a value.
- Do not put an email address, name, phone number or any other personal data in the call.
- Do not use any server API token or secret key here, and do not ask me for one. The browser call needs no key beyond the site key already in the script tag.
Bolt
Paste this into the Bolt chat after replacing PASTE_YOUR_SITE_KEY_HERE with your site key:
Add SourceTrack analytics to this Bolt project.
My SourceTrack site key is: PASTE_YOUR_SITE_KEY_HERE
This is a PUBLIC site key. It is meant to appear in the page source. Use only this value.
Do exactly this:
1. Work out what kind of project this is.
- Plain HTML, or a Vite or other single-page app with an index.html: add this one tag inside the <head> of index.html:
<script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>
- Next.js App Router: in app/layout.tsx add this inside <body>, after {children}:
<Script src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY" strategy="afterInteractive" />
and import Script from "next/script".
- Anything else: put the same script tag in the single HTML shell that every page shares.
2. Replace YOUR_SITE_KEY with my site key. Keep the src URL and the attribute names exactly as written. Add the tag in one place only, once.
3. Do not add cookies, a consent banner, or any other tracking code.
4. Do not ask me for, and never use, any server API token or secret key (anything starting with st_live_). Do not put a token in the code, in an environment variable, or in this chat. Only the public site key belongs in the browser.
5. Tell me which file you changed.
When you are done, I will publish, open my live site on the domain I registered in SourceTrack, and check that a request to /api/track completes.
Optional, to send conversions. Paste this as a second message:
Now send conversions to SourceTrack from this Bolt project. The tracking script is already installed.
Call window.sourcetrack.conversion(...) only after the action has really succeeded (the signup is saved, the form is accepted, the payment is confirmed), and guard it because the script loads asynchronously:
if (window.sourcetrack) {
window.sourcetrack.conversion({ type: 'lead' })
}
- Lead or signup: type "lead" or "signup". Send no value.
- Purchase: type "purchase", with order_id set to the real order or payment id, value set to the real amount, and currency set to its three-letter code. Never invent or estimate a value.
- Do not put an email address, name, phone number or any other personal data in the call.
- Do not use any server API token or secret key here, and do not ask me for one. The browser call needs no key beyond the site key already in the script tag.
Replit
Paste this into the Replit chat after replacing PASTE_YOUR_SITE_KEY_HERE with your site key:
Add SourceTrack analytics to this Replit project.
My SourceTrack site key is: PASTE_YOUR_SITE_KEY_HERE
This is a PUBLIC site key. It is meant to appear in the page source. Use only this value.
Do exactly this:
1. Work out what kind of project this is.
- Plain HTML, or a Vite or other single-page app with an index.html: add this one tag inside the <head> of index.html:
<script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>
- Next.js App Router: in app/layout.tsx add this inside <body>, after {children}:
<Script src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY" strategy="afterInteractive" />
and import Script from "next/script".
- Anything else: put the same script tag in the single HTML shell that every page shares.
2. Replace YOUR_SITE_KEY with my site key. Keep the src URL and the attribute names exactly as written. Add the tag in one place only, once.
3. Do not add cookies, a consent banner, or any other tracking code.
4. Do not ask me for, and never use, any server API token or secret key (anything starting with st_live_). Do not put a token in the code, in an environment variable, or in this chat. Only the public site key belongs in the browser.
5. Tell me which file you changed.
When you are done, I will publish, open my live site on the domain I registered in SourceTrack, and check that a request to /api/track completes.
Optional, to send conversions. Paste this as a second message:
Now send conversions to SourceTrack from this Replit project. The tracking script is already installed.
Call window.sourcetrack.conversion(...) only after the action has really succeeded (the signup is saved, the form is accepted, the payment is confirmed), and guard it because the script loads asynchronously:
if (window.sourcetrack) {
window.sourcetrack.conversion({ type: 'lead' })
}
- Lead or signup: type "lead" or "signup". Send no value.
- Purchase: type "purchase", with order_id set to the real order or payment id, value set to the real amount, and currency set to its three-letter code. Never invent or estimate a value.
- Do not put an email address, name, phone number or any other personal data in the call.
- Do not use any server API token or secret key here, and do not ask me for one. The browser call needs no key beyond the site key already in the script tag.
v0
Paste this into the v0 chat after replacing PASTE_YOUR_SITE_KEY_HERE with your site key:
Add SourceTrack analytics to this v0 project.
My SourceTrack site key is: PASTE_YOUR_SITE_KEY_HERE
This is a PUBLIC site key. It is meant to appear in the page source. Use only this value.
Do exactly this:
1. Work out what kind of project this is.
- Plain HTML, or a Vite or other single-page app with an index.html: add this one tag inside the <head> of index.html:
<script async src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY"></script>
- Next.js App Router: in app/layout.tsx add this inside <body>, after {children}:
<Script src="https://api.srctk.com/tracker.min.js" data-site-key="YOUR_SITE_KEY" strategy="afterInteractive" />
and import Script from "next/script".
- Anything else: put the same script tag in the single HTML shell that every page shares.
2. Replace YOUR_SITE_KEY with my site key. Keep the src URL and the attribute names exactly as written. Add the tag in one place only, once.
3. Do not add cookies, a consent banner, or any other tracking code.
4. Do not ask me for, and never use, any server API token or secret key (anything starting with st_live_). Do not put a token in the code, in an environment variable, or in this chat. Only the public site key belongs in the browser.
5. Tell me which file you changed.
When you are done, I will publish, open my live site on the domain I registered in SourceTrack, and check that a request to /api/track completes.
Optional, to send conversions. Paste this as a second message:
Now send conversions to SourceTrack from this v0 project. The tracking script is already installed.
Call window.sourcetrack.conversion(...) only after the action has really succeeded (the signup is saved, the form is accepted, the payment is confirmed), and guard it because the script loads asynchronously:
if (window.sourcetrack) {
window.sourcetrack.conversion({ type: 'lead' })
}
- Lead or signup: type "lead" or "signup". Send no value.
- Purchase: type "purchase", with order_id set to the real order or payment id, value set to the real amount, and currency set to its three-letter code. Never invent or estimate a value.
- Do not put an email address, name, phone number or any other personal data in the call.
- Do not use any server API token or secret key here, and do not ask me for one. The browser call needs no key beyond the site key already in the script tag.
Check that it worked
- Publish the site, then open it on the domain registered in SourceTrack. A preview address is a different site.
- In SourceTrack, open Setup & Health. Under Install the script, click Verify installation.
- You should see First event received.
Conversions and revenue
- A conversion sent from your page records that something happened. It is not proof of payment.
- Leads and sign-ups carry no revenue, so send no value for them.
- If Stripe or Shopify is connected, send the order id with every purchase so SourceTrack can match it to the real order.
- For revenue you can rely on, connect Stripe (https://www.sourcetrack.ai/docs/stripe) or Shopify (https://www.sourcetrack.ai/docs/shopify).
The browser conversion call is described in the Browser Conversions guide: https://app.sourcetrack.ai/developers/conversions