Updating Page Content Without Refreshing Page - real-time

I want to update recent notifications on the user's dashboard without refreshing it whenever there is a change in database notification table...as in Facebook where posts and comments are updated in real time...doesn't require page refresh. How can I do it. Any idea?
Thanks in advance.

I work for a company called Realtime (http://www.realtime.co) and we developed a very cool framework to work with real-time data.
It works on the cloud, we offer a lot of different APIs, you don't need to install anything and you can get a free account (with 1.000.000 free messages and 30.000 users per month). It allows you to push data to browsers, meaning you won't be hammering your server with AJAX requests.
On browsers, it uses websockets, if available. For older, non-websocket browsers, we will transparently fallback to whatever is that your browser can use.
Check out http://www.realtime.co and http://www.xrtml.org for downloads and documentation. Please let me know if you need any help as I am the Developer Evangelist for Realtime :)

It is something called asynchronous. Which you refresh the contents of a webpage or a DIV or anything else without reloading the page.
Actually you should use AJAX to load another page into a already present DIV in your page so it will be refreshed on a time basis.
AJAX
The documentation is really simple on w3 schools you can see there.
But the thing is you should use another page called a Handler or something to load and process the contents and then make them ready to be presented in your page and so you can load it time by time using javascript timers or etc.

Related

How can I keep in Google Analytics 2 Utms in paralel when one is changed with another?

I have developed an app that retargets customers when browsing a website and I have some problem with UTM tracking and Google Analytics.
For example if a client gets a customer to click on a FB ad and lands on their website they will have a custom FB utm. After browsing the website my app will display a pop-up and when a client clicks on it he receives my custom UTM.
The problem is that clients loose conversion rate data for the original traffic source and I need to figure out a solution.
Help is very much appreciate
It's not a good practices track with utm inside your site, if the pop-up is on the same domain, dont do it?
In you example, if the user comes from FB, yes, you need to tack with the utm, but the pop up is on your site... lets check the option?
If the asnwer is yes, try to track the user with a Custom Dimention on a Session Level, that will solve almost all your problems.
If the answer is no, you can only store a single UTM per sessions, that means that there is no option to avoid the overwriting the UTM, even consider the referal exclusion.
More about Custom dimentions:
https://support.google.com/analytics/answer/2709828?hl=en

Get Realtime Updates from a Facebook page

I am working on a web app that use Facebook login. The purpose of the app is to get information about fan pages that the user has in his account (for which he got admin privileges). I work mostly with the insights informations but this is not the issue. Now I would like to receive realtime update from the page like new messages, page posts reply etc. I've read the documentation https://developers.facebook.com/docs/reference/api/page/#realtime
and I don't understand the part about adding the app to the page. It is required that the app to be installed for example in one of the tabs? If so, is there a way not to do that and still receive the informations that I want? Also when I try to create a Realtime Update Subscriptions for the page object no "posts" field was available, then how to get realtime updates about it? I am a little confuse and any guidance and advise is more than welcomed.
P.S. I am using PHP SDK, if this helps with something.
I've read the documentation
How about reading it again?
I don't understand the part about adding the app to the page. It is required that the app to be installed for example in one of the tabs? If so, is there a way not to do that and still receive the informations that I want?
Quote from the docs part you linked to yourself:
Note: You might think that because you're adding this via the tabs API that this is a tab app. It's not. This app isn't visible to users as a page app and isn't managed via any UI.
Also when I try to create a Realtime Update Subscriptions for the page object no "posts" field was available, then how to get realtime updates about it?
You can subscribe to the page’s feed.

How to fetch data from website within the app?

I am developing an app for Lawyers to be used here in Brazil and one of the features of this app is to track the phase of the lawsuit as it develops through time.
It works like this: the user fill a form within the app with the info on the lawsuit and it is stored in a database. Whenever the user wants to know if the lawsuit has any new record, he'll push a button and will get the records ordered by date.
The website that the app will fetch is http://www.tjpb.jus.br the problem is that I don´t know how to code in order to get the app access that site, input the lawsuit number and get the reply displayed on an UIWebView.
So could anyone help me, or just give me a guide on where to find a solution for this?
You will need to asynchronously go to server(via that url) and parse data, then show the responses in UIWebView. But as far as i know you will need a PUSH Server and clerify which data you will show from that site.. This is a great source to get started with app development, you can find video lectures in i-Tunes too
I'm not sure what you really want to do, but one scenario could be that you build a URL, like
http://www.tjpb.jus.br/?...&...
and load it in an UIWebView or if there is a webservice there you should use a lib like ASIHTTPRequest to manage your API calls.

iPhone HTML5 website on homescreen with jQuerymobile offline splash page?

How do I go about loading a splash to the user if they are offline? I want it to show after the initial loading image, I have a page called gone-offline.jsp but how to detect if user is offline on mobileinit?
I'm not using phone-gap
You need to decide what offline means to your business scnenario. This may sounds silly, but it depends on what your app wants to do. For example:
Does your app want to go offline when it is actually offline and can't reach other websites, or does it want be in offline status when it can't access your webservice.
Assuming you want to test that there is no connection to your webservice I would recommend the following:
1) Make an ajax call every x number of minutes to your webservice to check if it is still online
2) make a common method that handles time outs if your application thinks its online and is offline.
3) make it so that when your application is offline, it is trying to get back online in the background by doing a similar step to step 1.
To do ajax with JQuery see: http://api.jquery.com/jQuery.ajax/
Note that if you require cross domain json (you may or may not) then you will need to investigate CORS/JSON-P/XSS with iframes.
it's very simple using javascript.
if(navigator.onLine)
{
//online code here
}else{
//offline code here
}
(done with jQ mobile)

Keeping track of the Facebook session when navigating pages in iframe-based Facebook applications

I'm working on an iframe-based canvas application and have run into a major roadblock in finding a good way to keep track of the Facebook session when navigating between pages within the iframe. On the first page load, the Facebook page passes all the necessary fb_sig parameters to your callback URL via the query string. On subsequent page loads (after clicking a link in your app, for example), it seems you must do one of the following to retain the Facebook session details:
Use target="_top" on links and reload the entire Facebook page with each request. That way a fresh set of fb_sig parameters are passed in when the iframe is loaded. But this incurs the cost of loading everything outside the iframe every single time you change pages.
Manually append all the fb_sig parameters you received from the first page to the URL of all additional pages. This is pretty ugly, and will leave you with outdated information that may no longer be accurate. You continue to use the first values you received from Facebook, but those values may have changed since then (such as the user logging out or the session key expiring) and you'd have no way of knowing.
Store the information in a cookie and somehow check for new values on each page load, refreshing it if necessary. I've seen this technique mentioned in several places, but after days of looking, I have not found a single example of how to actually do this. Perhaps the PHP client library does it for you automatically, but my application uses Perl and the WWW::Facebook::API module, and I haven't found anything in it that addresses this. I've also read that this technique runs into issues with certain browsers (Safari in particular) that don't allow you to set cookies within an iframe unless its domain matches the parent frame's domain. All of this seems extraordinarily complicated and poorly documented for what is such an elementary and necessary ability for an application (navigating to another page.)
Since I've been unable to find any really useful examples of how to achieve #3, I'm currently leaning toward #1, as unfortunate a compromise as it may be. Has anyone seen a good, complete explanation and example of how to use #3 that works in all major browsers? Figured I'd ask before I give up and go with #1.
Jimmy Cuadra, I had the same problem.
Try to put the absolute path to the facebook application (href="http://apps.facebook.YOURAPP/where_you_want_to_go.php"). And then go for #1 option (target="_top")
Hope it sove your problem.