FullCalendar.io - Get All Events - fullcalendar

I'm using the standard FullCalendar Events(as a json feed) and have everything working fine...almost.
var calendar = new Calendar(calendarEl, {
events: '/myfeed.php'
});
My initial view is a 'dayGridMonth' so the FC default behavior is to only retrieve the events for that month by appending the startParm/endParam querystring.
This is not what I want.
On the backend of this request, I'm currently sending the entire calendar feed (ignoring the start/end params) so I don't have to keep hitting my AJAX '/myfeed.php' page every time somebody clicks on "Next" to view the next month.
However, I can't get FullCalendar to know that it already has the whole json feed and not to bother getting anything else - just show the next month from the data we have. I've played around with lazyFetching but that seems to force that it goes to the AJAX call every time.
Any ideas on how I do this?
Thx!

Related

Trouble recreating Google Analytics (UA) events in GA4

I have a bunch of mp3s and an audio player on my site. In GA3 (UA) I had an event that fired every time I hit the play button on a specific track. The event name was jPlayer, the track in question is the variable 'mediaName', which is the name of the mp3 file which is derived when I click play. In my code, mediaName is a string that gets sent out to GA. i.e. mediaName might be 'mycooltrack.mp3', or 'anothergoodtrack.mp3'
ga ('send', 'event', 'jPlayer', mediaName);
After reading the GA4 docs, I guessed that I needed to make a custom dimension, called "Track" which took the User Property/Parameter: mediaName.
So the new code in my function looked like:
gtag('event', 'jPlayer', {
'Track': mediaName
});
But after several days this hasn't been working either.
I guess I don't really understand what dimensions are and how to send an event with an 'on-the-fly' name variable to GA4, like I've been doing with UA for years.
You need to first create the event in GA4 interface. https://support.google.com/analytics/answer/10085872?hl=en&ref_topic=9756175#zippy=%2Cin-this-article%2Creserved-prefixes-and-event-names%2Cweb
It is under "Configure" on the left-hand side. Then go through the steps.
Your configuration will look something like this, if you really like the "jPlayer" event name, then just replace "audio_play" with "jPlayer"
The code you used is still relevant and can stay the same, I'd just write "track" in lowercase.

How to re-fetch events when you navigate months?

I am working on fullcalendar + Nylas (Calendar Sync service).
Nylas is fetching only 1000 event per request from server. so I need re fetch new events on navigate every month full calendar. I need js code only for fullcalendar refetching event while navigate the months.
The Nylas Events endpoint has the option to filter GET requests by starts_after. You can make a request that searches from the start of the month and filter out any events that happen in the following month.

Send google analytics event in loop

I'm a newbie in analytics.
I want to track a record-created event every time someone creates a time-record in a web application for time-tracking. But the user can also copy a time record to multiple dates which should yield one record-created event for each new record.
Would a simple loop work or does google think my events are coming to them too fast? Should I add a setTimeout?
_.each(dates, function() {
ga('send', 'event', 'record-created');
// maybe wrap the line above in a setTimeout ?
});
As per documentation:
Each analytics.js tracker object starts with 20 hits that are
replenished at a rate of 2 hit per second. Applies to All hits except
for ecommerce (item or transaction).
Plus you have "only" 500 interaction hits per session, so you should not send too many events or GA will drop data.

stay on current month

When I am in the month view of FullCalendar, then say I go back a few months to March and click on an event, then hit the browser 'back' button, how can I make it so that the browser knows to go back to March? Currently, it just goes back to the current month.
Thanks
Here is one possible solution:
From eventClick callback, when you redirect the user to the other page. Also send current day, month and year of the calendar in the URL.
On that page get the values from URL and store them in session variables.
This is how you can get current date of the fullCalendar:
var calCurrDate = $('#calendar').fullCalendar('getView').start;
var date = calCurrDate.getDate();
var month = calCurrDate.getMonth();
var year = calCurrDate.getFullYear();
Now on calendar page check if those session variables are defined. If they are defined, add the following properties to fullCalendar
<cfif isDefined('SESSION.d')>
<cfoutput>
date: #SESSION.d#,
month: #SESSION.m#,
year: #SESSION.y#,
</cfoutput>
</cfif>
For server side language I've used Coldfusion (as I know only this). You can easily understand the logic and translate it to your desired language.
Note: At the end of the calendar page you must destroy the session variables. Otherwise every time when you refresh the page you'll be taken to the same day, month and year.
I hope this helps. Thanks

Refresh ASP.NET page periodically to display real time data from SQL Server

I have a shopping cart based application in asp.net 2.0 which uses the concept of group buying.My requirement is that when user checks out a particular product,he should do it with the latest price of that item at that time.
Now there is a scenario.
I have a product with price 50.I did a checkout.50 is displayed in my cart.At the same time some other user is accessing the product and now based on some business logic,we calculate the price.the second user did some activity which reduced the price to 45. I have a trigger which updates all shopping cart items with this new price.
I want to show this updated price on the frontend of the first user without a postback. or i want to give him a message that this price has changed so do a page refresh.
I have the following options.
1) The repeater control which shows the cart should be put under an update panel and that update panel should be refreshed after some interval using a timer.
2) use SQL Server notification services and invalidate the cache as soon as the data changes in database.
I do not want to use notification services as I am not caching the data.Secondly problem with update panel and timer control in that it will be a overhead to refresh it and refresh time is hard to find.
Please tell me a way to accomplish this scenario.
I would generate JavaScript that updates all Repeater items (html fields with prices), and has setTimeout() for periodical checking to web service (wcf, asmx or ashx) if price has changed. If it has, then i would retrieve all prices and update HTML fields! User don't need to prees anything, you can show him some notice that price has changed.
With jQuery and JSON for object serialisation this could be easily accomplished.
This is usually done via ajax from the client (browser) side of things. Perhaps this approach will work for your requirements as well?
Using ExtJs core, you can make an ajax call as follows:
Ext.Ajax.request({
url: 'ajax_demo/sample.aspx',
params : {'requestType':'check-sql-prices'}
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
// process the response JSON object.
},
failure: function(response, opts) {
// this writes the the firebug console.
console.log('server-side failure with status code ' + response.status);
}
});
Ext Core also handles "Timed Code Execution", so you could run the check, say, every 30 seconds. Round trip timing is usually less than 100 milliseconds, but that would definitely depend on your "SQL price checking" logic.

Resources