This site is protected by reCAPTCHA and the Google + Privacy Policy and + Terms of Service apply. +
+\`\`\` +``` + +### 5. Testing + +E2E test in `test/fixtures/basic/pages/recaptcha.vue`: +- Load script with siteKey +- Verify `grecaptcha.ready()` fires +- Verify `grecaptcha.execute()` returns promise + +## Files to Create/Modify + +- [ ] `src/runtime/registry/google-recaptcha.ts` (new) +- [ ] `src/runtime/types.ts` (add import + ScriptRegistry) +- [ ] `src/registry.ts` (add entry with scriptBundling) +- [ ] `docs/content/scripts/utility/google-recaptcha.md` (new) diff --git a/todo/tiktok-pixel.md b/todo/tiktok-pixel.md new file mode 100644 index 00000000..7222298a --- /dev/null +++ b/todo/tiktok-pixel.md @@ -0,0 +1,332 @@ +# TikTok Pixel Implementation Plan + +## Research Summary + +**NPM Package**: No official TikTok npm package. Load directly from TikTok's CDN. + +**Script URL**: `https://analytics.tiktok.com/i18n/pixel/events.js` + +**Pattern**: Queue-based like Meta Pixel. Simplified from TikTok's full SDK snippet. + +## Implementation + +### 1. Registry Script (`src/runtime/registry/tiktok-pixel.ts`) + +```ts +import { useRegistryScript } from '../utils' +import { object, string, optional, boolean } from '#nuxt-scripts-validator' +import type { RegistryScriptInput } from '#nuxt-scripts/types' + +type StandardEvents = + | 'ViewContent' + | 'ClickButton' + | 'Search' + | 'AddToWishlist' + | 'AddToCart' + | 'InitiateCheckout' + | 'AddPaymentInfo' + | 'CompletePayment' + | 'PlaceAnOrder' + | 'Contact' + | 'Download' + | 'SubmitForm' + | 'CompleteRegistration' + | 'Subscribe' + +interface EventProperties { + content_id?: string + content_type?: string + content_name?: string + contents?: Array<{ content_id: string, content_type?: string, content_name?: string, price?: number, quantity?: number }> + currency?: string + value?: number + description?: string + query?: string + [key: string]: any +} + +interface IdentifyProperties { + email?: string + phone_number?: string + external_id?: string +} + +type TtqFns = + & ((cmd: 'track', event: StandardEvents | string, properties?: EventProperties) => void) + & ((cmd: 'page') => void) + & ((cmd: 'identify', properties: IdentifyProperties) => void) + & ((cmd: string, ...args: any[]) => void) + +export interface TikTokPixelApi { + ttq: TtqFns & { + push: TtqFns + loaded: boolean + queue: any[] + } +} + +declare global { + interface Window extends TikTokPixelApi {} +} + +export const TikTokPixelOptions = object({ + id: string(), + trackPageView: optional(boolean()), // default true +}) + +export type TikTokPixelInput = RegistryScriptInput