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 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.
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?
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!
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
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
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.
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.
@yisrael-wix I was using it to access the Mixpanel project. Mixpanel needs the unique project code in order to receive events associated with a project. But since you said this, I removed the call to ‘wix-secrets-backend’ and hard-coded the project code into the Mixpanel call. Same result.
For clarification, my code is as follows
$w.onReady(function () {
console.log("Running onReady Function");
$w("#image6").hide();
$w("#image7").hide();
$w("#image8").hide();
$w("#EmptyFullStateBox").hide();
prompt.text = billSelect;
});
And I get no message in the console when the page loads. It was working fine until today when I added an onChange function to a couple of input fields.