I wanted to track end registration conversions for Source/Medium in Google Analytics. I've created an event goal for that:
1. Goal screenshot from GA
In order to fire the appropriate event that should be passed to goal, I use this code on a separate Double opt-in registration page, where user gets only once per life-time.
ga('send', {
hitType: 'event',
eventCategory: 'registration',
eventAction: 'test'
});
This event flows into goal, but very poorly, more than half of the events are not registered. If we compare exact same day to Facebook Pixel (which also fires in the same place), then this GA Goal shows 40-60% less conversions on average than FB pixel.
We've then additionally added
ga('set', 'transport', 'beacon');
And also added a forced timed hitCallback, so that it would definitely be sent.
We've also added a second test Goal and event for it, to measure end goal reach day to day.
2. Second, test goal screenshot from GA
This new event is fired in the same place, so it should be written in appropriate goal as well. But it's not. It's been more than 48 hours and goal is still empty.
3. Test goal is empty, but it should have around 95+ registered events
Events from both goals are recorded correctly and are shown in appropriate screenshots:
4. Test goal – events
5. Initial goal – doi events
Can anyone please help me to understand why this is happening and how to fix it?
A couple of things I can suggest:
Non-reporting of Test goal
The Category setting is case-sensitive and needs to match exactly what is reported by the event.
Your event hit sends a hit with category registration
Yet your goal setting is looking for a Category that equals Register
Recommendation: change Category equals to Register to Category equals to registration
Mismatch of goals to total events
I can't tell exact numbers of event hits vs goal completions from your screenshots. However, even without this information, the key reason why the numbers won't match is: Goals report on how many sessions resulted in a conversion. So if a user triggers a goal event multiple times in a session, it will simply be counted as 1 conversion
Related
I’m currently building a discrete event model where I’m trying to simulate port operations. In my model, I am looking to conduct “disruptions” using Event block. However, I couldn’t seem to find a way to specifically say how long the duration of the event ie the disruption will last. Can anyone help me with this? Thank you very much
to create disruptions you might want to use the downtime block if your disruptions are resource related.
If you want to use an event object to create a disruption for a particular amount of time, you might want to evaluate using dynamic events if you have multiple disruptions for different objects in your model
Otherwise you can use an event with mode "user control" and when you want to schedule a disruption, you can do:
event.restart(amountOfTime, TIME_UNIT);
the time units are for example HOUR, SECOND, YEAR etc
you can look at all the existent units in the help documentation
I am working on a robotics project where I control a robot using a joystick and the keys on my keyboard via a browser and a web server on the robot.
Right now the basic (browser side) implementation is a series of functional blocks that read the position of the joystick, the state of the joystick's buttons, and if certain keys have been pressed, sending this information to the server on the robot, using "requestAnimationFrame" as the looping mechanism.
The problem I am experiencing is that the connection between the browser and the robot is too "chatty" - there being updates almost continuously, even if nothing is happening.
Because of this, if I want to watch for a specific behavior on the server side, I cannot because the one useful message is swamped in (literally) thousands of "nothing happened!" messages.
The big problem here is the joystick itself as, as far as I know, there are two and only two events - connected and disconnected. Once the joystick status is "connected" the browser sends zillions of messages.
I tried using the timer object in the joystick API data structure as a way of creating a "something happened" event
Viz.:
function is_something_happening(jsdata, gopigo3_joystick) {
var old_time = gopigo3_joystick.time_stamp
while (old_time == Number.parseFloat(jsdata.timestamp).toFixed()) {
; // null statement so that this just spins. . . .
return;
}
}
What that does is cause the browser to freeze until the next joystick event happens.
Is there some way to program this so that nothing happens until I do something?
Something like a "you go do whatever you want, and when I need you I'll call you" kind of an interrupt or event driven thing - especially for the joystick?
Or, perhaps, there's a better way of debugging and/or trying to track specific events than the brute-force methods I'm using?
=================
Update:
Thanks for ALL the great ideas!
Let me clarify the problem now that I've gotten some feedback:
I am using an event listener for the keypresses and individual keypresses are sent to the robot to be acted upon, (or ignored), as the case may be. (i.e. Is this a key I'm interested in?) And the keyboard event routines work wonderfully - they only fire when I actually press a key. If the joystick isn't running, nothing happens until I press a key.
For the joystick, (i.e. "gamepad"), there are only two native events, one that fires if the gamepad is connected and one that fires when it is disconnected. Period, and that's it.
All, (and I do mean ALL), of the gamepad API demo's and examples assume that you're writing a game that will be played within the browser context so they all use requestAnimationFrame() as the driving element of their "game loop" and things happen at v_Sync speeds or whatever the browser allows.
Because of this, the gamepad object doesn't generate events after it's been started, it just runs and runs.
The only distinguishing factor is the gamepad's time_stamp attribute which increments whenever the gamepad is actually active, hence my use of gopigo3_joystick.time_stamp in my wait loop.
Obviously, I need to create a custom event that, somehow or other, can encapsulate the wait for the timer to increment, and only then allow the gamepad to send messages.
However, as far as I can tell, creating a custom event would simply move the spin-lock, (wink!), from the wait loop to the custom event as I read that customEvent()'s are synchronous - and I translate that to mean "blocking".
Is it possible to create an event that depends on a change in gopigo3_joystick.time_stamp, that will go off by itself and not block the rest of the browser's activity?
Allow me to apologize in advance - this is all virgin territory for me and I do appreciate all the advice and guidance you can give.
I hope that window.addEventListener works for you:
function doTheMovement(){
//your code
window.requestAnimationFram(doTheMovement)
}
window.addEventListener('keydown', function(event){
if(event.keyCode === "YOUR KEYCODE"){
//change direction of motion
}
})
window.addEventListener only goes 60 times per second, so it should be less damaging to your computer.
A page presents a dialog with an OK button. Under certain circumstances clicking the OK button fires its click-handler twice (event.timeStamp is identical). Invoking event.stopPropagation() in the click handler did not make the problem go away.
I've 'fixed' the problem by comparing event.timeStamp with its previous value. That is not a very satisfactory fix. What else might do the job?
The Circumstances
This problem follows relatively minor changes to code that has been running, and evolving, over years. There is a lot of it, and it would be difficult to pare the thing down to a few lines for illustration. The changes involved adding a dialog to load tide data for a year other than the current year. FWIW here's a very brief summary of how the page works.
On opening, it sends a GET request for a year's worth of tidal current data. Subsequently, a method increments a time, draws a field of vectors appropriate for that time over a NOAA chart, and schedules itself to run after a few seconds. It iterates in that manner over a time-frame.
The user can define a course, run a vessel along it, and see how current affects its track. The course definition, which includes a launch time, can be saved (as a cookie) and restored. If, when attempting to restore a course, available current data don't bracket the launch time, a warning is given and the dialog closes without changing the state of the page.
The user can then open a second dialog to GET the appropriate tide data. They can then try again to restore the course. This dialog changes the tide data and parameters describing the time and time-frame.
The problem - two responses to a single click - occurs only when an attempt to load a course fails, a new dataset is loaded, and a second attempt to load a course is initiated.
On that second attempt, code handling a click on the OK button of the load-the-course dialog gets the same Click event twice. I conclude it is the "same event" because the timeStamp value is the same. Oddly, the
If the tide data are loaded first, and then the course retrieved, the problem does not arise.
I'm not optimistic about an answer; a detailed description would be impossibly long. Constructive suggestions welcome. (event.preventDefault() does not change the behavior. Did not expect it to, but Due Diligence and all that.)
I'm working with a web page that has a tabbed display that simply hides all but the selected tab using the display style property. When a new tab is selected, a function is called that gathers some data from the page and writes it to an indexedDB object store to be used to restore the previous state of the tab, such as the selected element and cursor position, none of which seems efficient to save at every individual change.
At the same time, the important data is saved right away, such as a change event on a textarea, which will write data to the same object store as above.
My question is what should take place when the user writes new text to one of the textarea elements and, while the textarea still has the focus, clicks a button to navigate away from the tab (not the browser tab but just the tabbed display within the web page)? This single user action triggers two database write transactions at the "same" time and on the same object store.
In testing, I have tried to place a large amount of data in the textarea, before navigating away from that tab, in attempt at causing the change write event to take more time to complete; but, the write transaction triggered by the change event always completes before the event capturing the last state of the tab.
A reason for this may be that, apart from the last scroll position, all the data is taken from the dataset object of a small number of HTML elements, and that step may take longer before the transaction is even opened.
However, I'd like to feel more confident that this is coded as close to "fail proof" as possible, and would like to know how to prevent these two transactions from ever blocking or interfering in any way causing the loss of data or program failure.
I don't really know what to provide for a code example because there is nothing to show but a textarea element with a change event and a set of radio buttons, also with a change event, that invokes a function to gather data and open a write transaction before hiding one tab and showing the other.
Everything works and has not failed once yet, but how can I code it to be certain?
Thank you.
Addition After agonizing over this for awhile, I think I misunderstood the concept of blocking in indexedDB. I just assumed it had to do with two write transactions attempting to write to the same object store at the same time, but after reading further I don't think that is the case. If I understand correctly, this MDN document states that transactions are processed in the order they appear in the code, and the example is of two write transactions.
Thus, for my question of a change event triggering a write transaction at the "same" time as another write transaction is triggered, it would appear the only concern would be that one transaction overwrites the data written by the other transaction. The browser will handle the rest and I don't have to worry about transactions interfering or blocking, apart from their order when important. Blocking appears to be version change concern on an open database.
Regarding my original question, the change event always completed first in testing because its transaction was always opened first since it fires, I assume, on a blur event on the textarea which takes place before the change event on the radio buttons which fires on mouseup triggering the second write transaction. I assume that the second write transaction opened on the same object store won't begin until the first completes; but there isn't that level of description in the referenced document apart from below.
After the code is executed the object store should contain the value "2", since trans2 should run after trans1.
The point being that even if the first write transaction takes considerably longer relative to the second, the second will not start until after the first completes, and the only concern is the second transaction potentially overwriting data written in the first.
Sometimes I get myself confused and make issues where there aren't any and the coders of the browser have already taken care of it.
If I am still misunderstanding, I'd appreciate being corrected. Thank you.
basically I have set up event tracking across my website.
I simply want to be able to compare two events, if this is possible? So I want to see who clicked on X and then what number of those then went to click Y on specific events.
If this isn't possible, could you please suggest alternative methods of how I could do with within the GA interface?
Many thanks
Tim
Yes, you can, using Advanced Segmentation.
Basically, you'd set up an advanced segment for visits where users triggered Event X AND triggered Event Y. The resulting segment would show you visits where users who did both actions.
Note that this is limited to visit-level data; this won't show you users who triggered Event X in one visit, and then on a completely different visit, triggered Event Y. (This is a fundamental constraint of Google Analytics.)
Also now you can use events as goals: See Google's blog post here. This seems still to be disabled for some localized languages (and some profiles).