I attatched the eventDidMount hook to the calendar, but when my events are rendered the eventDidMount never gets called. However, all my other hooks work fine. Are there known issues with eventDidMount that can stop it from functioning? (ie, code placement, etc.)
Related
I have mysterious problem. Sometimes GTM records the event and sometimes it doesn't.
It's totally random. When I tested 3/3 it recorded and the next day 1/3, sometimes nothing etc ... I also compared the entire source code on the page to see if there is / isn't something else that might cause a problem in some cases. But in both cases, the source code is exactly the same. In both cases, the datalayer pretends that the event exist but GTM will not record it.
Do you have any idea what this can cause?
Left when it is fired.
Right when it is not fired
I would suggest that perhaps if you're setting up the click event on DOM ready, perhaps the element isn't actually drawn to the page by that time (e.g. if it's an SPA app like Angular or Vue) consistently. So sometimes the event is configured and you see the event fire and sometimes it's not, so you don't.
I have an id being pushed to my data layer via dataLayer.push() and there is no event key at the moment.
I know the best practice is to use an event key like 'event': 'idPush' and then in Google Tag Manager UI, have a trigger that activates when the custom event idPush occurs.
Is there is a way that I can still get the trigger to activate upon seeing a generic 'Message'?
I can't be 100% sure because I haven't read the GTM source code and I couldn't find any articles that talk about this, but I'm reasonably certain that this can't be done.
I tried:
creating a Custom Event trigger with a regex match of .* which would match anything, including nothing.
matching undefined, because according to the preview pane, the _event variable is set to undefined for Message events.
Unfortunately neither of these worked, and preview mode just says No tags were evaluated for the Message. This leads me to think that GTM only checks to see if any triggers should fire when an event is pushed into the dataLayer.
No. Until there was an event, GTM does not know about the content of the message - the message is just the debugger telling you that something has been added to the global dataLayer variable (which exists in the global namespace of the browser, not the confined namespace of GTM). The even is what updates GTM's internal state to make it aware of changes and additions to the dataLayer.
Depending on your use case you might be able to use a trigger type that creates it's own event - e.g. setting a visibility trigger to an element that you know will be at the viewport after your message, which will then take the new values of the dataLayer into account. Or create a custom HTML tag with a setInterval functions that periodically pushes an event to the dataLayer.
While these solutions may work, I do not think they are actually good. Finding a solution to change your page code will almost certainly be less headache in the long run than using a workaround.
I'm working on tracking down an elusive bug in IE11 and Edge. I've noticed a difference in the network calls between Chrome and Edge, and I'm not sure if that's just a difference between the way the browsers' dev tools display traffic or if it's indicative that something is actually happening in Edge that isn't in Chrome.
The following screenshot is from dev tools in Edge, recorded during page load.
It looks like some request to the server is not considered authenticated, so it's being redirected to the login page. The same page load sequence in Chrome does not show that - it just has the one page request. My first question is - is there a way to track down which thing is making that particular request using the Edge dev tools? Or is this something I need to worry about at all, if it's expected behavior?
Some background on the bug I'm trying to resolve
The page uses UpdatePanels and jQuery ajax both to make requests to the server. The relevant jQuery ajax calls are made in click events triggered on objects inside the update panels. I've verified that those click events aren't triggering a postback. The click handlers seem to be executing just fine (most of the time), but the bug is that sometimes they don't seem to be executed at all - none of my console.log statements appear in the console, and nothing happens (except the page jumps a little) until you click again. Every other click seems to work. It seems to happen when there is a lot of data loaded on the page (note the load time for the first request in dev tools).
I've made sure to rebind the click events that are on the objects inside the update panels after each update panel postback using
Sys.WebForms.PageRequestManager.getInstance().add_endRequest
The site uses forms authentication. There is just one server on the site I'm testing on - no load balancer involved.
Also - before anyone suggests it - we are trying to move away from the update panels, but we're not quite ready to retire this page which relies heavily on them. That would be my preferred solution, too :)
You mention that the webpage concerned is large.
Because of this, the JavaScript onload will not always have been completed yet when you do a quick first click on such a clientside hyperlink/button, which means that a regular http GET request gets triggered, which you see in the developer tools.
You will also see this in other browsers.
Try to find a way to disable these clientside hyperlinks/buttons before the onload has finished.
You could disable them initially via:
<a class="clientsideButton" href="#" onclick="javascript:return false">click here</a>
And enable them afterwards.
Don't forget to also re-bind them again after a partial postback!
<script>
$(function() {
$(".clientsideButton").on("click",
function() {
// Make AJAX request.
});
});
</script>
When I run the web application, I notice that Page_PreRender is fired twice. This only happens the first time in a new session. It does not happen if I refresh the page, or on postbacks.
I use .NET framework 3.5 and the built in ajax functionality.
The problem is not
related to img tag with empty src
attribute (which I have seen other posts with similar problem
has mentioned). I know this because I see this in
both FireFox and IE. The posts I saw
about this stated that this was not a
problem in IE. I have also searched
and found no img tags with empty src
in the generated page source, so it
should not be this.
I have also made a simple test
page where I have included some of
the functionality, and this does not
happen.
Have anyone any suggestions on what happens?
Note:
It is the entire page cycle that is firing twice, not just render.
I've experienced it; it's probably not what you are experiencing, but I'll enter it here anyway; I've noticed it when the application does a Response.Redirect at the PreRender level, which a redirect does not stop current execution, but makes it appear the event happens twice...
Again, probably not related, but including it just in case.
I copied some code that states:
Page.LoadComplete += new EventHandler(Page_PreRender)
I did not realize that this code fire for second time my Page_PreRender event.
When I comment it, never fire twice.
Here's the odd situation:
we have a piece of javascript library that is being called on our onload of aspx page.
It works everytime for us, but the clients that have low speed modems get an error, because the object is not getting initialized and the aspx page is already loaded.!!
Is there any suggestions on how to call this piece of js code?
Thanks,
make sure you have your end tags.. i have seen onLoads in the not working right when your core tags are incomplete or not properly formatted
The onload even happens when everything in the page is loaded. If you have some script that is loading from a different server (ads, statistics), the onload event won't fire until those are loaded also. If their server is having problems, your onload may never fire at all, or after several minutes when the browser gives up waiting.
Instead of using onload you could put your code in a script tag as early as possible in the page, i.e. after the last element that the script needs.
If you have some external script that doesn't need a specific place in the page (statistics for example), you can move it to the bottom of the page to minimise the risk of interference with the rest of the page.
With JQuery you can call your functions with ready event :
$(document).ready(function() {
// call your functions here
});
The event will be called when the DOM is loaded.