Timer until Event Occurs - google-analytics

Is there a way to track the time from when the "Window Loaded" event happens until a button is clicked on the page?
I tried several different things, like setting up a timer that would only fire if "Click Text" is "Download" but that doesn't stop the timer trigger from firing every second. I could never stop the timer on an event or a button click.
Brian

I found this answer from Simo about how to do this:
https://productforums.google.com/d/msg/tag-manager/xJ0RGC2wecY/rxmrJRklAgAJ
When you create a Universal Analytics tag, you need to add in all the required fields. Now you don't have any fields populated in your Timing hit so GA can't build any hit out of it.
You need to fill at least Category, Variable and Value fields: https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings
But judging from the bit you wrote at the end of your latest response, I think you've kind of misunderstood how the timer trigger works.
The timer trigger STARTS a timer upon the page load (GTM's default timer) or any user interaction (my custom timer). You still need to specify a "stop" to the timer to calculate how long something took. Neither GTM's default timer or my timer trigger can help you in identifying how long something took. They can simply be used to measure IF something took X seconds, where X seconds is the interlap between "interval" and "limit".
If you want to know the number of milliseconds from when the page was first loaded in the browser to any interaction such as a click of a button, all you need is a Custom JS variable:
function() {
return window.performance && window.performance.timing ? (new Date().getTime())-window.performance.timing.domInteractive : undefined;
}
This variable would return the time delta in milliseconds between when the variable was invoked and when the current page first became available to the user. So if you want to create a Timing tag out of this, make the Timing tag fire on the click of the button, and then in the timing Value field add a reference to this variable. Thus you'll have a Timing tag that sends the duration it took for user to land on the page and then click the button.
Simo

Related

Click Button in ExtendedSelenium2Library selects button very slow

I am using 'Click Button' from ExtendedSelenium2Library to select Login button on my login page.
But is takes more than 12 seconds to select the Button. With Selenium2library it works immediately.
I prefer using Extendedselenium2 instead of selenium2. How to make it click faster?
TL;DR
Click Button ${button} True
Seems you already figured this out, but I had the same problem and it took some time to figure it out. So this is for future reference.
ExtendedSelenium2Library waits for AngularJs to be ready to process the next request. As can be seen here ExtendedSelenium2Library (and like you already said). So by using these commands that wait for Angular to be ready, when you are not using AngularJS, it is necessary for the timeout to kick in which is about the 12-14 seconds you experienced. To still be able to use the extended library and have "fast clicking" you need to set the argument "skip ready" to "True".
Example:
Click Element xpath=//a[#href="#/motor"]
Becomes
Click Element xpath=//a[#href="#/motor"] True

To prevent access other pages of asp.net application on button click

I have one requiremt like There is button which is named Start/Stop. When he clicks the button first time number of hours caluclated until he clicked second time on same button (i.e Stops).
E.g:- He clicks first time (time interval should be caluclated) and he clicks second time (stop) after 8 hours. So total time is 8 hours.
2) When he clicks first time (i.e Start ), appliation should not allowed to access of other pages. Once he clicks second time (i.e Stop) then it should allow the application.
Thanks,
Ravikiran
One of the way of making it work is to use the modal popup covering the entire page once the user clicked the start button and put the second button on the top of it to close . jqueryUI modal popup is one of the example. My solution does not stop user to type the path in the URL and try. In that case you can put the value in Session with the flag saying
if(Session["Started"] != null)
{
//redirect to same page where the timer is running
}
This is going to be almost impossible to stop the user from going to another page via the address bar.
Ignoring the address bar problem for a minute, you will need to have client-side logic to check for events happening in the browser (i.e. user closing a tab, hitting back button, etc.), which if you are only using server-side logic it will be too late to catch.
It really sounds like you need for this to be a WinForms/WPF/Silverlight application instead of a browser-based application, because of your need to restrict navigation.

filter mouse move event and send again

My program is working on Qt, and I have a problem and there is free answer for it in website.
Our products need to update image while user move mouse, but the updating image is very time-consuming.If user move the mouse quickly, the system will generate a lot of mouse movement events, eventually leading to clogging of the background process.Therefore, we need to filter out part of the event.
I filter mouse move event by insert event filter in QApplication:
qApp->insertEventFilter(this)
Once I catch mouse event, I will store QMouseEvent and pointer of QObject, and active QTimer. other mouseMouseEvent will can overwrite them before timeout. After timeout, the last event will be post.
I can't use:
QApplication::sendEvent(XX) or postEvent(xx)
because it will be catched by my event filter again.
How can I make it work?
Don't filter the events. Instead of that, change your background worker which is responsible for producing the data to make sure that you do not spend time on stuff you won't need.

Who should remove popup, calling app or popup itself?

Here is the scenario...I have an application that has an "Open" button. When you click the open button, a TitleWindow pops up (via the PopUpManager) a dialog that allows you to select a record. In that window, you can either click "Ok" once you've selected a record, or cancel the dialog which should close the window.
What is the best way to handle this, knowing I need to return the record number to the main application? Right now I have the main application opening up the custom TitleWindow. In the TitleWindow, I have an event that fires when the user clicks "Ok" and a record is selected. That's how the main application listens for the recordId. What I'm wondering is if I can do something like this:
private function RecordSelected():void
{
this.selectedRecord = someControl.selectedIndex;
this.dispatchEvent(new Event("RecordSelected"));
PopUpManager.removePopup(this);
}
Will the instance of the TitleWindow stay active until after the event is handled by the main application, or could it be removed before the main application fully handles the event (thus ending with a null reference exception)?
Alternatively, is it better to close the window in the event handler like so:
private function titleWindow_RecordSelected(event:Event)
{
var openDialog:CustomTitleWindow = CustomTitleWindow(e.currentTarget);
this._selectedRecord = openDialog.selectedRecord;
PopUpManager.removePopup(openDialog);
}
I'm also wondering if sending the selection out in an event is the best way to do this also. Any insight would be appreciated. Thanks in advance.
What is the best way to handle this,
knowing I need to return the record
number to the main application?
Best is always subjective, but I usually handle closing of the window in the window component; and then dispatch an event with appropriate data (In this case Record No) back to the application. It sounds like your 90% there. Just instead of dispatching an event Event, create a custom Event class with your recordID. Then it won't matter if the pop up is still in memory or not when you need to use the record ID.

SliderEvent.clickTarget does not change

In my web based flex app I have a HSlider to which 'change' event listener is binded. Inside the event listener function I have the following.
trace('slider click target: '+e.clickTarget);
I am changing the slider value from a timer (say every second). At this time, in the console I see that traget is being printed as null every second.
Now, if I change the value by dragging the thumb, it prints target as thumb. And then onwards it keeps printing the target as thumb every second instead of printing null. The same thing happens if change the slider value by clicking track (it keeps printing track).
Basically, I have the event listener to find out if the value of the slider is changing due to the timer, click on thumb or click on track. Kindly let me know if this issue can be fixed or is there any other approach I can follow. Thanks!!
This is strange, because the documentation says that the change event is dispatched when the slider changes value due to mouse or keyboard interaction - the event is not triggered when you change it programmatically, and the listener shouldn't even be called.
Are you calling the event listener manually? Post some more code - where you update the slider value and the full event listener.

Resources