Jump to content

Share FB post with game screenshot and custom text.


Nellykey
 Share

Recommended Posts

Hi,

I`m implementing facebook share button in my game. I`ve made with sharing pic and some description using code like this:

        var prefix = "https://www.facebook.com/sharer/sharer.php";
        var text = "?t=Check+it!"
        var gameUrl = "&u=" +  window.location.href; 
        var postfix = "?mbid=social_fb_onsiteshare";
        var url = prefix + text + gameUrl + postfix;
        var win = window.open(url, '_blank');
        win.focus();

And I get picture from open graph:

        <meta property="og:title" content="Post Title" />
        <meta property="og:image" content="url" />

As you can see now I use the same picture and text for each player. But I want to share game screenshot and title "I got N scores!" with users highscore.

How can I make it? 

Link to comment
Share on other sites

Thats the old (and I think deprecated) way of sharing stuff with facebook.

You'll need to register your site as an app with FB and use the FB api to post more interesting things, their documentation isn't as clear as it could be and I haven't found any clear and up-to-date tutorials either (I use to do this sort of thing semi-regularly for clients and always rued not making a dedicated library for myself, I always forgot how to do it properly and had to go look up the docs each time, stupid stupid).

Once you've registered yourself with FB, which is easy and pretty quick, you can do a lot of powerful and interesting things with their api, plus they can do a good analytics job for you as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...