datafast
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to Use This Skill
何时使用该工具
- You need to instrument a website (static, SPA, Next.js, Astro, etc.) with DataFast tracking.
- Revenue needs to be attributed to marketing channels (Stripe, LemonSqueezy, Polar, custom providers).
- You want to record custom events/goals reliably despite ad blockers.
- You must proxy the tracker/script for increased data quality or hashed navigation.
- You want to export/import historical analytics or query DataFast APIs.
- 您需要为网站(静态站点、SPA、Next.js、Astro等)部署DataFast跟踪功能。
- 需要将收入归因到营销渠道(Stripe、LemonSqueezy、Polar、自定义提供商)。
- 您希望在存在广告拦截器的情况下仍能可靠记录自定义事件/目标。
- 必须代理跟踪器/脚本以提升数据质量或适配哈希路由。
- 您需要导出/导入历史分析数据,或调用DataFast API。
Quickstart (4 steps)
快速开始(4步)
- Install the tracking script inside :
<head>html<script defer data-website-id="dfid_XXXX" data-domain="example.com" src="https://datafa.st/js/script.js" ></script>- Customize via ,
data-allow-localhost,data-api-url,data-debug,data-allowed-hostnames,data-disable-console.data-allow-file-protocol - Include the snippet to queue calls that happen before the library loads.
datafast-queue
- Customize via
- Connect payment providers (Stripe, LemonSqueezy, Polar, Shopify, etc.) from the Revenue tab so DataFast auto-tracks revenue.
- Add custom goals/events with ,
window.datafast("my_goal")attributes, or the server-side Goals API.data-fast-goal - Optional proxy to bypass ad blockers: rewrite and
/js/script.jsto your domain and forward visitor IP with/api/events.x-datafast-real-ip
- 在中安装跟踪脚本:
<head>html<script defer data-website-id="dfid_XXXX" data-domain="example.com" src="https://datafa.st/js/script.js" ></script>- 可通过、
data-allow-localhost、data-api-url、data-debug、data-allowed-hostnames、data-disable-console进行自定义配置。data-allow-file-protocol - 加入代码片段,以在库加载前对调用进行排队。
datafast-queue
- 可通过
- 连接支付提供商(Stripe、LemonSqueezy、Polar、Shopify等):从收入选项卡进行配置,DataFast将自动跟踪收入数据。
- 添加自定义目标/事件:使用、
window.datafast("my_goal")属性,或通过服务端Goals API实现。data-fast-goal - 可选代理配置以绕过广告拦截器:将和
/js/script.js重写到您的域名下,并通过/api/events传递访客IP。x-datafast-real-ip
Installation Reference
安装参考
- Scripts load via components in frameworks (Next.js App Router, React, Vue, Astro, etc.) or declaratively in
<Script />.public/index.html - For hash-based navigation, use the hash-enabled script .
https://datafa.st/js/script.hash.js - Use GTM, Shopify, Webflow, Wix, Podia, Kajabi, Ghost, Bubble, Framer, Astro, React Router, Laravel, Django, FastAPI, Flask, Express, PHP, Nginx, Firebase, Rocket, etc., by dropping the same script into the or platform-specific head/custom code sections.
<head>
- 可通过框架中的组件(Next.js App Router、React、Vue、Astro等)或在
<Script />中声明式加载脚本。public/index.html - 对于基于哈希的路由,使用支持哈希的脚本。
https://datafa.st/js/script.hash.js - 可在GTM、Shopify、Webflow、Wix、Podia、Kajabi、Ghost、Bubble、Framer、Astro、React Router、Laravel、Django、FastAPI、Flask、Express、PHP、Nginx、Firebase、Rocket等平台中使用,只需将相同的脚本添加到或平台特定的头部/自定义代码区域即可。
<head>
Revenue Attribution Best Practices
收入归因最佳实践
- After the tracking script is live, go to Website Settings → Revenue and add each payment provider.
- Always pass (and optionally
datafast_visitor_id) when creating checkout sessions:datafast_session_id- Stripe Checkout / PaymentIntent: read the cookies from or
cookies()and add them torequest.cookies.metadata - LemonSqueezy: include DataFast cookies under .
custom - Polar: add cookies to .
metadata - Paddle / Dodo Payments / Easytool / Custom: call the Payments API or trigger a goal with the customer email.
payment
- Stripe Checkout / PaymentIntent: read the cookies from
- For gateways where DataFast already pulls revenue (Shopify, Stripe, LemonSqueezy, Polar), keep the tracking snippet installed but omit redundant manual events.
- Document the metadata mapping and ensure downstream jobs read for each financial event.
datafast_visitor_id
- 跟踪脚本上线后,进入网站设置 → 收入并添加每个支付提供商。
- 创建结账会话时,务必传递(可选
datafast_visitor_id):datafast_session_id- Stripe Checkout / PaymentIntent:从或
cookies()中读取Cookie,并添加到request.cookies中。metadata - LemonSqueezy:在字段下包含DataFast Cookie。
custom - Polar:将Cookie添加到中。
metadata - Paddle / Dodo Payments / Easytool / 自定义提供商:调用Payments API或触发包含客户邮箱的目标。
payment
- Stripe Checkout / PaymentIntent:从
- 对于DataFast已自动拉取收入数据的网关(Shopify、Stripe、LemonSqueezy、Polar),保留跟踪代码片段,但无需添加重复的手动事件。
- 记录元数据映射关系,并确保下游任务为每个财务事件读取。
datafast_visitor_id
Custom Events & Goals
自定义事件与目标
Method 1 – window.datafast()
(client-side)
window.datafast()方法1 – window.datafast()
(客户端)
window.datafast()- Fire on clicks, success pages, or after API responses.
window?.datafast("goal_name") - Record parameters: .
window.datafast("checkout", { price: "49", plan: "pro" })
- 在点击事件、成功页面或API响应完成后触发。
window?.datafast("goal_name") - 记录参数:。
window.datafast("checkout", { price: "49", plan: "pro" })
Method 2 – HTML data attributes
方法2 – HTML数据属性
- Add to buttons/links.
data-fast-goal="goal_name" - Enrich with attributes (
data-fast-goal-*becomesdata-fast-goal-price="49").{ price: "49" }
- 为按钮/链接添加属性。
data-fast-goal="goal_name" - 通过属性丰富数据(
data-fast-goal-*将转换为data-fast-goal-price="49")。{ price: "49" }
Method 3 – Server-side Goals API
方法3 – 服务端Goals API
- POST to with
https://datafa.st/api/v1/goals,datafast_visitor_id, and optionalname.metadata - Authenticate with .
Authorization: Bearer YOUR_API_KEY - Ensure the visitor already had at least one pageview (tracked via the script).
- 向发送POST请求,携带
https://datafa.st/api/v1/goals、datafast_visitor_id及可选的name。metadata - 使用进行身份验证。
Authorization: Bearer YOUR_API_KEY - 确保访客已至少有一次页面浏览记录(通过脚本跟踪)。
Funnels, Scrolls, & Filters
转化漏斗、滚动跟踪与筛选器
- Use on critical sections (features, pricing, testimonials) to send scroll goals when 50% of the element is visible.
data-fast-scroll - Combine scroll goals with funnels () to spot drop-offs.
landing page visit → feature scroll → CTA click - Track UTM/ref/via parameters automatically tracked by DataFast; encourage marketing links to include ,
?ref=,?utm_source=,?utm_medium=,?utm_campaign=, and?utm_term=.?utm_content - Use filters to slice by country, device, campaign, URL path, or custom goals; hover charts expose filter shortcuts.
- Provide docs for localStorage to exclude internal traffic.
datafast_ignore
- 在关键区域(功能介绍、定价、客户评价)使用属性,当元素50%可见时发送滚动目标事件。
data-fast-scroll - 将滚动目标与转化漏斗(着陆页访问 → 功能区域滚动 → CTA点击)结合使用,定位流失节点。
- DataFast会自动跟踪UTM/ref/via参数;建议营销链接包含、
?ref=、?utm_source=、?utm_medium=、?utm_campaign=和?utm_term=。?utm_content - 使用筛选器按国家、设备、营销活动、URL路径或自定义目标拆分数据;悬停图表可显示筛选快捷方式。
- 提供localStorage的使用文档,用于排除内部流量。
datafast_ignore
Proxy & Hosting Guidance
代理与托管指南
- Proxy requests so the script loads from and events post to
/js/script.json your domain./api/events - Forward the visitor IP with to keep geolocation accurate.
x-datafast-real-ip - Next.js rewrites, Express HTTP proxy, Flask/FastAPI routes, PHP scripts, Nginx/Caddy rules, Firebase Functions, and DigitalOcean/Nginx examples are ready-made patterns—adapt whichever matches your stack.
- Allowlist additional domains via and set
data-allowed-hostnames="app.io,shop.example.com"to the root domain to share cookies across subdomains.data-domain - Use or
data-api-urlendpoints when custom routing is needed; the tracker auto-detects proxied setups.datafast_events
- 代理请求,使脚本从您域名下的加载,事件提交到
/js/script.js。/api/events - 通过传递访客IP,以保持地理位置数据的准确性。
x-datafast-real-ip - 已提供Next.js重写、Express HTTP代理、Flask/FastAPI路由、PHP脚本、Nginx/Caddy规则、Firebase Functions及DigitalOcean/Nginx的现成配置示例,可根据您的技术栈进行适配。
- 通过添加允许的域名列表,并将
data-allowed-hostnames="app.io,shop.example.com"设置为根域名,以在子域名间共享Cookie。data-domain - 当需要自定义路由时,使用或
data-api-url端点;跟踪器会自动检测代理配置。datafast_events
API & Export/Import
API与导出/导入
- DataFast APIs (Overview, Timeseries, Devices, Pages, Countries, Referrers, Campaigns, Goals, Payments, Visitors, Metadata, Realtime) all require .
Authorization: Bearer <API_KEY> - Use the Payments API to push revenue from unsupported providers: include ,
amount,currency, and the visitor ID.transaction_id - Use the Goals API for server-side events (max 10 metadata keys).
- Import Plausible exports into DataFast to keep historical data; reference .
Import your Plausible data - Export to dashboards via the API Playground, Real-time endpoints, or custom scripts.
- 所有DataFast API(概览、时间序列、设备、页面、国家、引荐来源、营销活动、目标、支付、访客、元数据、实时数据)均需使用进行身份验证。
Authorization: Bearer <API_KEY> - 使用Payments API从不受支持的提供商推送收入数据:需包含、
amount、currency及访客ID。transaction_id - 使用Goals API处理服务端事件(最多支持10个元数据键)。
- 将Plausible导出的数据导入DataFast,以保留历史数据;可参考「导入您的Plausible数据」文档。
- 通过API playground、实时端点或自定义脚本将数据导出到仪表板。
Mobile & Support
移动端与支持
- Install the DataFast mobile app (iOS/Android) to monitor metrics on the go; connect any site with an API key.
- Use Google Search Console integration for keyword influence; ensure your domain is verified and you have owner/full permissions.
- Track GitHub commits in your dashboard to correlate releases with revenue spikes.
- Reach out to or
marc@datafa.stfor help, feature requests, or troubleshooting.https://feedback.datafa.st/
- 安装DataFast移动端应用(iOS/Android),随时随地监控指标;使用API密钥连接任意站点。
- 集成Google Search Console以分析关键词影响;确保您的域名已验证,且拥有所有者/完全权限。
- 在仪表板中跟踪GitHub提交记录,关联版本发布与收入峰值。
- 如有问题、功能请求或故障排查需求,可联系或访问
marc@datafa.st。https://feedback.datafa.st/
Troubleshooting Checklist
故障排查清单
- Script not firing headers? Confirm the tag is inside and the
<head>domain matchesdata-website-id.data-domain - No revenue? Verify payment provider connection plus metadata cookies in Stripe/LemonSqueezy/Polar sessions.
- Goals not recorded? Ensure goal names use lowercase/underscores/hyphens and do not exceed 64 characters.
- Vercel preview showing no data? Enable during staging or rely on proxied script in production.
data-allow-localhost="true" - Proxy showing all visitors from server IP? Add or forward
x-datafast-real-ip.X-Forwarded-For
- 脚本未触发请求?确认标签位于内,且
<head>对应的域名与data-website-id匹配。data-domain - 无收入数据?验证支付提供商已连接,且Stripe/LemonSqueezy/Polar会话中包含元数据Cookie。
- 目标未被记录?确保目标名称使用小写/下划线/连字符,且长度不超过64个字符。
- Vercel预览环境无数据?在 staging 阶段启用,或在生产环境使用代理脚本。
data-allow-localhost="true" - 代理显示所有访客均来自服务器IP?添加或转发
x-datafast-real-ip。X-Forwarded-For
References
参考资料
- Script configuration reference: ,
data-allowed-hostnames,data-api-url,data-allow-localhost,data-disable-console.data-debug - Revenue attribution guides (Stripe Checkout, PaymentIntent, Checkout Links, LemonSqueezy, Polar, Paddle, Dodo Payments, Easytool).
- Technology-specific install docs for Shopify, Webflow, Wix, Ghost, Next.js, Astro, Laravel, React Router, Firebase, Astro middleware, Caddy, Nginx, DigitalOcean, etc.
- 脚本配置参考:、
data-allowed-hostnames、data-api-url、data-allow-localhost、data-disable-console。data-debug - 收入归因指南(Stripe Checkout、PaymentIntent、结账链接、LemonSqueezy、Polar、Paddle、Dodo Payments、Easytool)。
- 特定技术的安装文档:Shopify、Webflow、Wix、Ghost、Next.js、Astro、Laravel、React Router、Firebase、Astro中间件、Caddy、Nginx、DigitalOcean等。