HotJar tracking Code

Hi,

I need to add something like this to the page:

<script>
    (function(h,o,t,j,a,r){
        h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
        h._hjSettings={hjid:99999,hjsv:6};
        a=o.getElementsByTagName('head')[0];
        r=o.createElement('script');r.async=1;
        r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
        a.appendChild(r);
    })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>

As you can see it uses window and document javascript objects. How can I do one of the following:

  1. append my own html to head or any other element
  2. access global window object
  3. any other ideas on how to add this?

PS: The HTML Element wix provides in UI does not work due to iframe limitations

Many thanks and hope someone can help me with this.

Patrick

3 Likes

bump

I have the same question

This contains a message to wix creators and describes how inflexible solution this is Installing javascript code on Wix websites - A1WebStats can anyone from wix answer us here please? We really need tracking to elevate our businesses!

Agree, looking for a solution to this problem was the main reason I joined the Wix Code beta. Can someone get back with a clear answer on how this or is not supported by Wix Code? And if it isn’t, if it is planned?

This is answer from Wix Support:

*Unfortunately our developers are not able to add this tracking code. This type of tracking isn’t currently possible at Wix because of the way the websites are setup and coded. *

*If you really want this tracking, you’ll have to use a traditionally coded website, like WordPress. *
So I guess I will be switching to someone else which is a shame because there are some great features here but I cant loose tracking and conversion events.

It would be great to get someone associated with the Wix Code beta to confirm. The support team just handles what Wix currently supports, not including the Wix Code beta.

Any help here to confirm from the Wix Code team?

Hi Everyone,

First of al, I’m sorry for the delay of the answer.

Wix code is about making it easy to interact with your Wix site components.
window and document elements are not exposed, therefore you can’t use Wix code to inject code directly into your HTML site.

Anyway, we are aware of this request and we hope to solve all of your problems :slight_smile:

Patrick,
I suspect that this is not a Wix support genuine answer, Can you please share the resource in which you got that answer from?

Thanks,
Liran.


It was from your support. Any timeline on a possible solution for this @Liran?

Nope, sorry. All I can say for now is that we are aware of this request.
Thanks for sharing this with me :slight_smile:

Liran.

Hey Patrick … this is now available …