Script tag for analytics
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
guys for analytics and the script tags im using the Script tag from nextjs i notice events are fired but the apps dont detect that the tracking is setup, has it have to do with the stragey like afterInteractive or ?
appreaciate help tahnks.
appreaciate help tahnks.
9 Replies
Can you share your script?
Carpenter wasp
but the apps dont detect that the tracking is setup
You'll have to be more specific - how the script is injected and how you observe that the "apps dont detect that the tracking is setup" - which code chekcs it and how.
Most common case would be that you initialize something like GTM or Posthog with raw scipt tag, but then use e.g. react library to interact with it. If Iguess correctly, the correct solution would be to use native library only.
Sun bearOP
yeah let me share
so im using the nextjs script tag
and im using the native applications way of checking the script existence
for example:
{/* Trustpilot Widget */}
<Script
src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js"
strategy="afterInteractive"
/>
{/* Trustpilot Widget */}
<Script
src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js"
strategy="afterInteractive"
/>
i noticed that on page switch as well sometimes the widget disassperas and fallsback
i current have it in the main root layout of my nextjs app