You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use tracker functions (e.g. trackEvent) from JavaScript. If I paste the tracking code into the document's <head>, everything works as expected. However, I seem to have problems with dynamically adding the <script> tag in an Angular component
(Note: {hostname} and {website-id} are replaced with my actual parameters.)
This correctly adds a <script> and also tracks a page view, but umami is undefined and I cannot call the functions I am interested in. I also tried omitting the defer attribute, but this does not change anything.
Similarily to the GA code, I have also tried to add an additional <script> tag, which looks like this
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to use tracker functions (e.g. trackEvent) from JavaScript. If I paste the tracking code into the document's
<head>
, everything works as expected. However, I seem to have problems with dynamically adding the<script>
tag in an Angular componentWith Google Analytics, the code looks like this
When I try a similar approach with Umami, I cannot get a reference to
umami
, orumami.trackEvent
(umami
is undefined).What I have tried so far:
(Note:
{hostname}
and{website-id}
are replaced with my actual parameters.)This correctly adds a
<script>
and also tracks a page view, butumami
is undefined and I cannot call the functions I am interested in. I also tried omitting thedefer
attribute, but this does not change anything.Similarily to the GA code, I have also tried to add an additional
<script>
tag, which looks like thisSame result as above.
Any idea what I can do?
Beta Was this translation helpful? Give feedback.
All reactions