This sample shows how to add the X Pixel to a plain HTML site, with no build step. Each page has the X conversion tracking base code in its <head>, which sends a page view when the page loads. The Buy button on the home page sends a purchase event.
Replace the placeholders in index.html and about.html:
YOUR_PIXEL_ID: your pixel ID from X Ads Events ManagerYOUR_PURCHASE_EVENT_ID: the event ID of a purchase event you create in Events Manager. It looks liketw-abc12-def34.
Serve the folder over HTTP. The pixel doesn't run on pages opened from the file system.
npx serve .Open the site, visit both pages, and click Buy. Check the requests with the X Pixel Helper.
Paste the base code before </head> on every page, as in these files. Then add event code wherever a conversion happens, such as a button click or a thank-you page. See the implementation best practices.