Habe heute Abend Woopra getestet. Geboten wird ein Dienst, welcher Echtzeit-Statistiken von Webseiten generiert. Hierzu wird ein Javascript-Code-Schnipsel auf der gewünschten Website eingebunden, welche einen Connect auf die Woopra-Server macht und dabei Server- und Client-Daten übermittelt. Nette Idee, funktioniert auch. Für mich dennoch untauglich. Mehr dazu weiter unten.

Die Bedienung der Woopra-Website ist einfach und intuitiv. Zunächst muss ein Profil angelegt und per E-Mail-Verifizierung bestätigt werden. Dann können die Websites (anhand von Domains) angelegt werden, die getracked werden sollen.

Im Quellcode der fraglichen Webseiten muss nun der kleine Javascript-Schnipsel eingebunden werden. Sofort darauf werden die Live-Statistiken entweder über das Dashboard der Woopra-Website oder aber über ein entsprechendes Desktop-Programm ausgegeben. Ich hatte den Mac OS X Client getestet. Dieser schaut sehr ansprechend aus und stellt die Informationen nett dar.

Für mich kommt Woopra in dieser Form nicht in Frage, denn es deckt nicht mal die Hälfte meiner Anwendungsfälle ab. Konkretes Problem ist, dass ich zahlreiche Seiten betreibe, die keinerlei oder besondere Header-Informationen senden und mit der Javascript-Ausgabe im BODY nicht klar kommen. Spätestens bei einem 301-Header ist hier Schluss, das funktioniert nicht mit Javascript.

Das erinnert mich daran, dass ich mit (m)einem unlängst eingeschlafenen eigenen Webanalyse-Tool weitermachen sollte. Bereits vor einem Jahr hatte ich eine lauffähige Version, die in ähnlicher Weise wie Woopra arbeitet und auch viele brauchbare Daten bereitstellt. Aus Zeitgründen war dieses Projekt eingeschlafen. Vielleicht mache ich bei Gelegenheit damit mal weiter und erfinde Google Analytics neu 🙂

after migrating websites and databases onto new hardware last weekend, I took the chance and did, what was way long overdue: I made an upgrade to WordPress 3.0 yesterday. Even though several other blogs of friends and those all around the world mentioned heavy problems and various plugins malfunctioning after the upgrade, it worked very well for me. Hier geht's weiter... » // Read more... »

Hi there,

during the past few days, unfake.it‘s performance increased dramatically. Several scripts and jobs have been moved onto new servers, the database structure and various SQL statements have been enhanced and even SQL SELECT statements have been optimized to more and more use readonly slave servers. Most URLs are being faked in much less than a tenth of a second. The magical previews of faked URLs are generated almost instantly, since performance increased dramatically.

Unfortunately, faked URLs weren’t posted to Twitter when using the WordPress Plugin during the past 4 hours due to a tiny misconfiguration. This issue could be solved.

unfake.it has become a more and more commonly used URL shortener during the past months. Almost 1.000 URLs are faked in a 24 hour period, even though this magic edge has not yet been crossed. See the stats for more information ’bout that.

Bye, Thomas

Hi there!

Quite a while ago, I started writing my first and own facebook application. I got stuck while trying to publish content to my own profile page and also to my friends’ newsfeeds. I stumbled upon several problems. Either there was no content displayed, it was formatted in a wrong way, it was not published on my friends’ newsfeeds or it even was published on behalf of my friends’ username. It was quite strange to me and I could not find an easy documentation on how to do it the right way.

I played around with Stream.publish, Feed.publishUserAction or Notifications.send – none of those functions did what I wanted them to do. This may be so, because I did not fully understand their purposes.

So, this is my way to do it. I am using the FBJS (FaceBook JavaScript) popup call Facebook.showFeedDialog. This is truely (as far as I’m concerned) the best and easiest way.

First of all, I assume you are familiar with how to build an facebook application from scratch. If not, please read the developer’s documentation.

Step 1: build and register your Feed Template Bundle

  1. go to the Feed Template Console
  2. choose your application and hit “Next”
  3. create a template for your “One Line Story” and hit “Next”
  4. create a template for your “Short Story” and hit “Next”
  5. create Action Links and hit “Next”
  6. hit “Register Template Bundle”
  7. copy and save the Template Bundle ID given in the popup (you will have to paste it into your application’s code later)

When doing this, you may enter any text or even HyperText in the fields for the One Line or Short Story. You also may enter predefined tags such as {*actor*} or your own defined tags such as {*foobar*}. In the Sample Template Data, you may enter the tag definitions and display a preview. What you enter there and at this very moment has no effect on the content displayed within your application later! That’s just for previewing purposes. The real content will be defined later in your application’s script. Remember that! Some Examples for your Sample Template Data at this point may be:

{"foobar": "This is a foobar text"}

Or a bit more complex:

{&quot;foolink&quot;: &quot;&lt;a href=&quot;http://www.google.com/&quot;&gt;Google&lt;/a&gt;&quot;,</p>
<p>&quot;images&quot;:[{&quot;src&quot;:&quot;http://domain.com/image1.jpg&quot;, &quot;href&quot;:&quot;&lt;a href=&quot;http://www.facebook.com/&quot;&gt;http://www.facebook.com&lt;/a&gt;&quot;},</p>
<p>{&quot;src&quot;: &quot;http://anotherdomain.com/image2.jpg&quot;, &quot;href&quot;:&quot;&lt;a href=&quot;http://www.facebook.com/&quot;&gt;http://www.facebook.com&lt;/a&gt;&quot;}]}

You see, e.g . the {*images*} tag is defined as some sort of array consisting of multiple SRC and HREF values. Attention: the special tag {*images*} is displayed automatically on Short Stories, you don’t need to call them!

2. write your application’s content

<?PHP</p>
<p>require_once 'facebook-platform/php/facebook.php';</p>
<p>$appid = 'xxxxxxxxx'; // your app ID</p>
<p>$appapikey = 'XXXXXXXXXXXXXXXX; // your app key</p>
<p>$appsecret = 'XXXXXXXXXXXXXXXX'; // your app secret</p>
<p>$template_bundle_id = 'xxxxxxxxxxxxxxxx'; // the ID you got in Step 1</p>
<p>$facebook = new Facebook($appapikey, $appsecret);</p>
<p>$user_id = $facebook->require_login();</p>
<p>echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";</p>
<p>?></p>
<p><script type="text/javascript"><!--</p>
<p>    var template_bundle_id ="";</p>
<p>    var url="http://www.google.com/";</p>
<p>    var user_message_prompt = "Share this URL with your friends?";</p>
<p>    var user_message = {value: "wants to share a greate website."};</p>
<p>    var image ="http://www.google.com/intl/en_ALL/images/logo.gif";</p>
<p>    var template_data = {"url": url,</p>
<p>                                  "images": [{'href': url, 'src' : image}]};</p>
<p>    Facebook.showFeedDialog(template_bundle_id, template_data, '', '', '', user_message_prompt, user_message);</p>
<p>// --></script></p>
<p>

This is it.

Every time you call your application’s page, you’ll get a facebook popup asking you to display the content on your profile and even in your friends’ newsfeeds. Of course, it does not make any sense to share some data every time you call your application’s canvas page, so you may want to add some more code to your application.

The text to be shared is the text you entered when registering the Template Bundle in Step 1. If you get an error, please make sure the defined variables (such as “url” or “images”) are valid and do exist. In other words: whatever you call in your Template Bundle, it has to be defined in your script.

Of course, you may generate the content dynamically from a database or any other source.

I hope this HOWTO helped.

Bye, T.

Hi there!

A few days ago, I started to write my first own facebook application. It all went quite okay until one certain point: I wanted my application to update the profile box of the user, which uses the app at that single moment. And that wasn’t as easy, as I thought.

The problem was: after the profile box has been updated, all profile boxes of all users had the same content – the content of the user who last updated his profile box.

I will come to the solution later. First of all, a quick explanation of what I needed to do:

  1. I read the documentation of facebook’s application guide to understand the API and the FBML language
  2. I set up my own application using the step-by-step guide
  3. I set up my new application on my own host including facebook’s PHP libraries

Here’s the code step-by-step (just put all sniplets together):

Code sniplet #1

require_once 'facebook-platform/php/facebook.php';

$appid = 'xxxxxxxxxxxx';
$appapikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$appsecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();

Above: first of all, we need to include facebook’s PHP libraries, define several variables for our application, initialize our facebook object and retrieve the UID of the user who currently uses the application.

Code sniplet #2

$fb_box = "<H4 class='box_header clearfix'><span>";
$fb_box .= "Hello World!";
$fb_box .= "</span></H4>";
$fb_box .= "<div>I am ";
$fb_box .= "<fb:name uid=\"$user_id\" useyou=\"false\" />.";
$fb_box .= "Nice you're on my page.</div>";
$fb_box .= "Some more content in HTML or FBML...";

Above: we then define the content which we want to be displayed within the profile box. In this examble, it will be the name of the user, greeting the visitor.

Code sniplet #3

$fb_box_handle = 'pb_' . $appid . '_' . $user_id;

Above: this is important! At this point, I got stuck for a while. The reason was, facebook caches profile boxes content until the application’s canvas page is requested for the next time. The handle is very important for that caching mechanism, since it has to be a unique identifier for each application and each user. For that reason, I simply use the prefix ‘pb_‘ followed by the applications ID (defined above) and the UID of the current user (also defined above)!

Code sniplet #4

$facebook->api_client->call_method('facebook.profile.setFBML',
array(
'api_key' => $appapikey,
'v' => '1.0',
'uid' => $user_id,
'profile' => '<fb:narrow><fb:ref handle="' . $fb_box_handle . '" /></fb:narrow>',
'profile_main' => '<fb:ref handle="' . $fb_box_handle . '" />',
)
);

Above: the rest is quite simple. We make an API call to facebook and send our application key, the protocol version, the UID of the facebook user whose profile box ought to be updated and, of course, the content for that box. The content will be sent as the reference handle we defined earlier.

If you want to update multiple profile boxes with one single API call, I guess, this could work if you send an array containing the UIDs. If not, you can still get all those UIDs, walk through the array and perform multiple API calls. I read somewhere, some users had problem updating large numbers of profiles… Just give it a try.

Comments (if it worked for you or even if it didn’t) are appreciated 🙂

UPDATE because of comment #2:

The example above is about updating content in a users profile, not about setting up a profile box on a profile. You should read the manual carefully.

A user has to approve a certain application to create a profile box. Therefore, you need to render a button, which sets up the box. You can easily do this by:

$appapikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$appsecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
$facebook->api_client->profile_setFBML($appapikey, $user_id, 'profile', NULL, 'mobile_profile', 'profile_main');
echo "<fb:add-section-button section='profile' />";

The last line renders the button, you want to have on your canvas page.

Good luck! Thomas