google adsense in facebook application - facebook

how can i add google adsense in facebook application

You have to put the code in a seperate html file and load that file into a frame and call that using the fb:iframe code.
There are issues with Googles TOS in doing this but this is explained and code examples are given here: http://netodex.com/?p=223
Andy

Sorry you can't have any more ads on facebook by google adsense. since google did not sign a compliance agreement with facebook.

<script type="text/javascript">
<!--
google_ad_client = "pub-0663894775040736";
/* 300x250, date de création 06/05/11 */
google_ad_slot = "0095835646";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>

Related

Getting one product information from category page in Magento

¡Hola,
I'm trying to set up this darn Google trusted stores script on my Magento website. I seems Google wants me to add the below javascript to every page and call only one product from each page. That's okay for product page but I'm having some trouble on other pages like the category pages. I suppose I could somehow add the script to template/catalog/product/list.phtml So anyway, I was wondering if I could add the just the first product listing on each category page with PHP to the Google javascript?
Has anyone have figured out how to add the script like Google wants to Magento or is there a tutorial about it somewhere?
Here's the Google javascript:
<!-- BEGIN: Google Trusted Stores -->
<script type="text/javascript">
var gts = gts || [];
gts.push(["id", "xxxxxx"]);
gts.push(["google_base_offer_id", "<?php echo $this->htmlEscape($_product->getSku()) ?>"]);
gts.push(["google_base_subaccount_id", "xxxxxxxx"]);
gts.push(["google_base_country", "US"]);
gts.push(["google_base_language", "EN"]);
(function() {
var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
var gts = document.createElement("script");
gts.type = "text/javascript";
gts.async = true;
gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(gts, s);
})();
</script>
<!-- END: Google Trusted Stores -->
Thanks
I'm such a dummy the code is already in the Google Trusted Stores Module. :)

adsense ads not showing up on site

Hmm ... not sure why, but adsense ads aren't showing up on this site (http://dapperhawk.com). The code is exactly the same as is provided on the adsense site as far as I can tell:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-1773904113940189";
/* bottom_results */
google_ad_slot = "0900749086";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Any thoughts on how one might troubleshoot this?
Just to follow up on this ... I sent an email to google support, and got a response that essentially said, "it looks like it's working now". I didn't change anything :-/

How to redirect from Mobile Safari to Native iOS app (like Quora)?

On my iPhone, I just noticed that if I do a Google Search (in Mobile Safari) and select a result on quora.com, the result page launches the native Quora app on my phone.
How is this done? Specifically, is it a detection of the user agent and the use of an iOS URL scheme? Can it tell if the native app is installed and/or redirect to the app store?
I'm reposting an answer to my own related (but was originally Ruby-on-Rails-specific) question from here: Rails: redirect_to 'myapp://' to call iOS app from mobile safari
You can redirect using javascript window.location.
Sample code:
<html><head>
<script type="text/javascript">
var userAgent = window.navigator.userAgent;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
window.location = "myiosapp://"
}
</script>
</head>
<body>
Some html page
</body>
</html>
Just a small improvement of the JS code, if the app is not installed, it will send the user to itunes store ;)
<script type="text/javascript">
// detect if safari mobile
function isMobileSafari() {
return navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/)
}
//Launch the element in your app if it's already installed on the phone
function LaunchApp(){
window.open("Myapp://TheElementThatIWantToSend","_self");
};
if (isMobileSafari()){
// To avoid the "protocol not supported" alert, fail must open itunes store to dl the app, add a link to your app on the store
var appstorefail = "https://itunes.apple.com/app/Myapp";
var loadedAt = +new Date;
setTimeout(
function(){
if (+new Date - loadedAt < 2000){
window.location = appstorefail;
}
}
,100);
LaunchApp()
}
</script>
You can do trigger your application to be launched using custom URL scheme, registered by your application with the iOS runtime. Then on your website, write code to detect the incoming User-Agent and if iOS is detected generate your custom URL's instead of regular http ones.

Facebook wall posts

I need some help please. I've been lost in the graph facebook documentation for the last 2 hours. Please send an advice about how could I get my facebook wall posts/info, etc . . . ? I need an access token. I've tried in many ways to get it, but is useless. I don't understand how to build that url . . . Please, just tell me from where should I start? Thank you!
It's not very clear what you are trying to do or what language you are trying to do this in. But the graph api isn't very difficult to tackle if you follow their documentation. You need to first prompt the user to authenticate with your application and any extended permissions. Then you can make calls to the graph api (or FQL queries if needed).
Here is a full example of getting Facebook wall posts like you asked. Reading wall posts will require the read_stream extended permission.
<!DOCTYPE html>
<html>
<body>
<div id="fb-root"></div>
Get Feed
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId : 'yourFacebookAppId', status : true, cookie : true, xfbml : true });
function getFeed() {
FB.login(function(response) {
if (response.session && response.perms) {
FB.api('/me/home',
function(response) {
alert(response.data.length);
for (var i = 0; i < response.data.length; i++) {
alert("message from " + response.data[i].from.name + ": " + response.data[i].message);
}
}
);
}
} , {perms:'read_stream'});
}
</script>
</body>
</html>
This can also be done in server code like PHP but for generic questions like this and first getting started the javascript api is probably the easiest until you know more of what you are trying to do.
https://developers.facebook.com/docs/authentication/
Facebook Platform uses the OAuth 2.0 protocol for authentication and authorization. We support a number of different OAuth flows that you can use within your Website, mobile and desktop apps.
This document outlines that different mechanisms Facebook Platform uses to support each of these flows. The examples in this document use PHP for server-side programming and HTML/JavaScript for client-side code. These examples are very straightforward and easily translatable to other languages.
This is where you need to start.
try this one https://graph.facebook.com/USER_ID/feed?access_token=TOEKN
Just replace the USER_ID and TOKEN with the users id and access_token and you'll get a list of all the wall posts in a json format and also you can navigate the result page using the Previous and Next link at the bottom .
Hope that will solve your problem .

Connect to Facebook with Javascript Client Library using Adobe AIR

I'm having an issue connecting to Facebook through the Javascript Client Library in Adobe AIR. It works fine in the browser but in Adobe AIR it seems to not be able to find the Facebook functions. Here is some code I copied from the Facebook website: (Oh and I have the xd_receiver.htm file in the correct path too)
<textarea style="width: 1000px; height: 300px;" id="_traceTextBox">
</textarea>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
//
var api = FB.Facebook.apiClient;
// require user to login
api.requireLogin(function(exception){
FB.FBDebug.logLevel=1;
FB.FBDebug.dump("Current user id is " + api.get_session().uid);
// Get friends list
//5-14-09: this code below is broken, correct code follows
//api.friends_get(null, function(result){
// Debug.dump(result, 'friendsResult from non-batch execution ');
// });
api.friends_get(new Array(), function(result, exception){
FB.FBDebug.dump(result, 'friendsResult from non-batch execution ');
});
});
});
//]]>
</script>
It's not that simple actually man, the problem with loading external script files from the application sandbox is that it's not supported. Technically, by using iframes, you should be able to do this and it works but it's still impossible to use XFBML in the root document after from my experience. After two days of trial and error, the easiest way to do use Facebook Connect in an html/ajax adobe air application is to download the actionscript library and include it as such:
<script type="application/x-shockwave-flash" src="lib/facebook.swf"></script>
<script type="text/javascript">
var FB = window.runtime.com.facebook;
var fb = new FB.Facebook();
var session = new FB.utils.DesktopSessionHelper();
//etc...
</script>
then just refer to the documentation. my only problem now it that I still haven't found an efficient enough way of using XFBML in adobe air, simply adding the facebook namespace to the html tag doesn't do the trick unfortunately. If any knows, please do share thanks
you also need to change xml namespace (main html tag) to this:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en-gb" lang="en-gb">