Implementierungsleitfaden
React- / Next.js-Integration
Integrieren Sie Tagtics mit modernen Lifecycle-Hooks. Der Client übernimmt Routenwechsel automatisch für Sie.
Initialisierung
Rufen Sie init auf, wenn Ihre App gemountet wird, und destroy beim Unmounten, um Speicherlecks zu vermeiden.
import { useEffect } from 'react';
function App() {
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://cdn.tagtics.online/client.js';
script.async = true;
script.onload = () => {
window.Tagtics?.init({ apiKey: 'YOUR_API_KEY' });
};
document.body.appendChild(script);
return () => {
window.Tagtics?.destroy();
script.remove();
};
}, []);
return <YourApp />;
}