YouTube 视频播放器
<iframe width="100%" height="400" src="https://www.youtube.com/embed/VIDEO_ID" frameborder="0" allowfullscreen></iframe>
Google Maps 地图
<iframe src="https://www.google.com/maps/embed?pb=EMBED_CODE" width="100%" height="400" frameborder="0" allowfullscreen></iframe>
Calendly 预约系统
<div class="calendly-inline-widget" data-url="https://calendly.com/your-username/30min" style="min-width:320px;height:630px;"></div> <script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>
Twitter 社交内容
<blockquote class="twitter-tweet"> <a href="https://twitter.com/username/status/STATUS_ID"></a> </blockquote> <script async src="https://platform.twitter.com/widgets.js"></script>
Disqus 评论系统
<div id="disqus_thread"></div> <script> var disqus_config = function () { this.page.url = window.location.href; this.page.identifier = 'page_id'; }; (function() { var d = document, s = d.createElement('script'); s.src = 'https://YOUR_SITE.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })(); </script>
Google Analytics 4 数据追踪
<!-- 在网站 head 部分添加 --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXXX'); </script>
// 追踪购买事件 gtag('event', 'purchase', { transaction_id: '12345', value: 25.42, currency: 'USD' }); // 追踪表单提交 gtag('event', 'form_submit', { form_name: 'contact_form' });
OpenAI ChatGPT 智能对话
import { serve } from "https://deno.land/std@0.168.0/http/server.ts" serve(async (req) => { const { message } = await req.json() const response = await fetch('https://api.openai.com/v1/chat/completions', { method: 'POST', headers: { 'Authorization': `Bearer ${Deno.env.get('OPENAI_API_KEY')}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ model: "gpt-3.5-turbo", messages: [{ role: "user", content: message }], max_tokens: 150 }) }) const data = await response.json() return new Response(JSON.stringify(data)) })
SendGrid 邮件发送
import { serve } from "https://deno.land/std@0.168.0/http/server.ts" serve(async (req) => { const { to, subject, content } = await req.json() const emailData = { personalizations: [{ to: [{ email: to }] }], from: { email: "noreply@yourdomain.com" }, subject: subject, content: [{ type: "text/html", value: content }] } const response = await fetch('https://api.sendgrid.com/v3/mail/send', { method: 'POST', headers: { 'Authorization': `Bearer ${Deno.env.get('SENDGRID_API_KEY')}`, 'Content-Type': 'application/json' }, body: JSON.stringify(emailData) }) return new Response(JSON.stringify({ success: response.ok })) })
Twilio 短信发送
import { serve } from "https://deno.land/std@0.168.0/http/server.ts" serve(async (req) => { const { to, message } = await req.json() const accountSid = Deno.env.get('TWILIO_ACCOUNT_SID') const authToken = Deno.env.get('TWILIO_AUTH_TOKEN') const fromNumber = Deno.env.get('TWILIO_PHONE_NUMBER') const credentials = btoa(`${accountSid}:${authToken}`) const smsData = new URLSearchParams({ To: to, From: fromNumber, Body: message }) const response = await fetch(`https://api.twilio.com/2010-04-01/Accounts/${accountSid}/Messages.json`, { method: 'POST', headers: { 'Authorization': `Basic ${credentials}`, 'Content-Type': 'application/x-www-form-urlencoded' }, body: smsData }) return new Response(JSON.stringify(await response.json())) })
Stripe 高级支付功能
import { serve } from "https://deno.land/std@0.168.0/http/server.ts" serve(async (req) => { const { amount, currency, customer_email } = await req.json() // 创建支付意图 const paymentIntent = await fetch('https://api.stripe.com/v1/payment_intents', { method: 'POST', headers: { 'Authorization': `Bearer ${Deno.env.get('STRIPE_SECRET_KEY')}`, 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ amount: amount, currency: currency, receipt_email: customer_email, automatic_payment_methods: JSON.stringify({enabled: true}) }) }) const data = await paymentIntent.json() return new Response(JSON.stringify(data)) })
Was this page helpful?