I have placed an HtmlElement on my wix page, and in there, there is a code that integrates with my Google Analytics code. On page load, I am setting an id with google analytics, and then creating a custom tracker. All of that code needs to be executed on page load (inside $w.onReady(...))
Problem is that $w.onReady(...) is not firing on page load and is not setting a unique client id that I am sending via URL. It is also not creating my custom GA tracker (which will be created if $w.onReady(...) fires.
Worst is, that unless and until the page loads, wix does not allow me put a debug point on any code that is inside $w.onReady(...) because it only opens the code file to debug once the whole page is loaded. Debugging kind of becomes useless after that.
I understand how to implement Mixpanel; that is not the issue. But once implemented, using the instructions mentioned, it prevents $w.onready() from firing. Like I said, I can provide code and log screenshots.
To what Yisreal said above, actually I have 2 situations when $w. onready() does not write "Hello World" to the console log.
a) import { getSecret } from wix - secrets - backend;
b) var Mixpanel = require ( ' mixpanel ' );
If either of these is added to code, I don't get "Hello World" in the console log. I can attach the code and console log screenshots if you need.
This is a showstopper for us, if we are not able to track Analytics such as Mixpanel. Kindly advise as this is holding us back.
Further update:
1) I have search bar in the header together with a repeater.
2) The repeater displays a list of product images from the database based on the search
3) The images are linked to the Product Page Url using the settings for image database connection (bottom setting)
3) My SITE code is designed to clear out the Search bar and collapse the Repeater:
$w.onReady(function() { console.log("hello world"); $w("#search").value = null; $w('#repeater1').collapse(); });
It runs perfectly navigating from the Repeater on every page EXCEPT when a Product page is displayed (as above).
In this situation, the $w.onReady(function() does not run on any product pages when navigated from the Repeater images.
Further, I have noticed $w.onReady(function() does not run when navigating from Product to Product
using the < Prev | Next > nav in the Product page.
I would really appreciate help if anyone has any ideas.
Best from a rainy Cambridge UK
Ted
As Yisrael suggested, I included:
console.log("hello world")
at the end of the code above.
"Hello world" appears but the $w instructions do not run for some reason whilst on the Project page.
I will try and see if I can get something else to run.
Ted
I have exactly the same problem, this code is SITE posted and works perfectly from every page other than the Product Page.
$w.onReady(function() { $w("#search").value = null; $w("#search").value = null; $w('#repeater1').collapse(); });
Note I used the Wix automatic store builder. It works on all the collection and non dynamic pages but for some reason not on the Products page.
Is this a bug? More likely me!
Any help gratefully received
Ted
I need help with getting the $w.onReady() function to be called on my product page. I've the same code in my product galleries which works fine. When I put it in the product page it doesn't seem to fire. All I'm trying to do is an Insert into a database collection. Can anyone help?
I need help with the $w.onReady() function. I have the same code in non dynamic pages and it works fine. When I put the same code in my stores product page it doesn't fire off my code. Again it works fine on my other pages. Is there a workaround? Is this intentional? Thanks for your help.
The page's onReady() function always fires - always. Add a console.log("hello world"); statement inside the onReady() function and see for yourself.