Skip to main content
Trakg works seamlessly with React by using a simple <script> tag that tracks all form interactions β€” including abandoned fields. You don’t need to modify your form structure or write any special handlers.

πŸ“¦ Where to add the script

In most React apps created with Create React App (CRA), the best place to add the Trakg script is inside the public/index.html file. Paste the following line before the closing </body> tag inside public/index.html:
πŸ” Replace YOUR_ID_GIVEN with the unique Site ID from your Trakg dashboard.

πŸ“ Full Example: public/index.html

πŸ›‘ Best Practices

βœ… Always use the defer attribute β€” it ensures the script loads after HTML is parsed
βœ… Keep the script at the end of the <body> for non-blocking performance
βœ… No need to wrap your form with providers or HOCs β€” Trakg works with standard HTML form tags
βœ… Works with any form built using form, input, textarea, or select

πŸš€ You’re Ready!

Once installed, visit your Trakg dashboard to:
  • View partial and completed leads
  • See real-time form activity
  • Export your lead data anytime