Share user messages from my app to twitter - twitter

In my app, I am designing to allow user share messages to twitter. But those messages could already exceeded the 140 character constraint put on tweets, what will be the best way to work around that?

You can't work around the limit. If the 140 characters are exceeded twitter would not accept the message. I suggest you use a tweet-shortener like I do for my app.
What it basically does is if the number of tweets => 140, strip it in half, create a html page containing the full tweet, send back the shortened tweet and the link to the app, then paste it.
But there are already third party tweet-shorteners available so you can try out any one.
http://www.google.com/search?gcx=w&sourceid=chrome&ie=UTF-8&q=tweet+shortener
http://www.google.com/search?gcx=w&sourceid=chrome&ie=UTF-8&q=tweet+longer

It seems like the standard here is to create a shortened URL to the full version of the message to put at the end of the tweet, then fill the remaining space with as much of the message you can fit in 140 characters (with option trailing ellipsis). So, like:
"This is my message I want to share, and it is really lon... http://my.shrturl.com/aJdD"
Also, take a look at TwitLonger maybe? http://www.twitlonger.com/

Related

Why is a number in my link text appearing as *************** (stars)?

I have posted this as, although I worked out the answer, I could not find anything about it in a Google/stackoverflow search. I hope it might help someone in the future.
My C# MVC app generates a link and emails it to the user. In the email the html is simply a link tag with the url used as the href and the link text.
In the email in Outlook the link displays as below:
http://mydomain.com/Foo/Bar?id=6***************
When you hover over the link it shows as
http://mydomain.com/Foo/Bar?id=6523054102058710
The numbers should always show, otherwise the user may be suspicious.
It turns out that the number I was generating was 16 digits, inadvertently the same as a credit/debit card number. This meant that some email clients were hiding the number to protect privacy.
To solve the problem I simply changed the number of digits.

Find the number of times a tweet has been viewed

There have been quite a few number of start-up pertaining to analyzing Twitter data. There is CrowdBooster, then there is Klout, which use Twitter data to tell the user their True reach.
I have got the following two questions:
1) Is there a way to find out who has viewed one's tweet, or the number of people that have viewed a tweet. Crowdbooster claims to tell you how many impression one received per tweet. How do they do it?
2) Thousands and thousands of links are shared each day on Twitter. Can we find out which user has clicked the link in a tweet?
I have looked through Twitter API and some of the companies that have licensed Twitter's Firehose, but have not found anything that meet my needs.
Also, to give you a short answer to your 2nd question. Now that we've established that view analysis is impossible. Can you find out which user has clicked on that link, absolutely. And depending on what your talking about, user as far as the user who has clicked on the link or the user that has the link on their Twitter stream. Both are possible,
in the case of A, you would get the referring users IP address. Methods vary depending on language.
But what I think your asking for is scenario B, finding out which user has the link in their Twitter stream. This can be done by querying the link, the API response you will get can include tweet entities which will list all this information out for you and more. Open up a firehose with your link and watch what comes in.
https://dev.twitter.com/docs/streaming-api/methods
1) Is there a way to find out who has viewed one's tweet, or the
number of people that have viewed a tweet. Crowdbooster claims to tell
you how many impression one received per tweet. How do they do it?
No, in the case of a view - this would be impossible. The tweet impression can happen in multiple silos. On the website, in a widget, in a mobile app. You can imagine that it's simply not possible to get the impression of a tweet on a view because of this reason and because unlike a click, there is no I viewed this tweet identifier sent when a view has been enacted. I spent a great deal of time researching for a way to get the tweet impression even based on a similar clicked link and this is not even possible. (edit: it's possible see the last paragraph) This brings us to question 2.
2) Thousands and thousands of links are shared each day on Twitter.
Can we find out which user has clicked the link in a tweet?
Yes, what these websites are mainly doing is analyzing links that you process through their website. If you can have a unique hash marker on a link then analysis becomes possible. Without a unique hash marker, Twitter will re-interrupt two of the same links in a exactly the same way, even in the case that it shortens your link to it's custom t.co wrapper.
This means the only reliable way to do tweet analysis is by including a unique link marker code on your tweet and analyze the the fact that somebody that has hit your server has clicked on that link.
There is a somewhat hidden Twitter API feature that helps you understand how popular a particular link is. That being the link count API .. http://urls.api.twitter.com/1/urls/count.json?url=
Something really outside of the box you can do if your set on analyzing multiple versions of exactly the same link without using markers and if your also using the Streaming (firehose) would be to analyze the tweet views (using the link count API) on similar links that hit your server. The link that got the +1 boost in view is the one that hit your server. But that's about the extent of creative analysis you can get with your tweets and more specifically the links, as mentioned links are the only thing your really able to analyze when it comes to Twitter.
1) Is there a way to find out who has viewed one's tweet, or the number of people that have viewed a tweet. Crowdbooster claims to tell you how many impression one received per tweet. How do they do it?
Yes, sign up for Twitter Analytics https://analytics.twitter.com (free service provided by Twitter) and you can see how many people view (impressions) for each tweet and totals for specific dates or a date range.
2) Thousands and thousands of links are shared each day on Twitter. Can we find out which user has clicked the link in a tweet?
Yes, you can do this. Using a URL shortening service like Bitly.com you can track how many clicks you had from Twitter (only give out that Bitly link on Twitter to do this). But if you want more indept information you may need to create a tracking software, as I don't know of any available. To do that you would need the tracking software to track the link and find out the refer header and see if it's from Twitter (or better yet, just give out a unique URL for your tweets), then you would need to use the Twitter API to find out the handle (username) of that visitor who clicked your link. Lastly store this information in a database so you can review who clicked what link.

How to add Twitter Expanded Tweets? (was: twitter media preview card for my site?)

I googled a lot about how to make twitter media preview for my website entities if they are linked in a tweet like images below:
Any idea where can I find some documentation about it? Or a tutorial? Is this possible or these media/site previews are hardcoded in twitter?
EDIT:
so, what I need:
If someone links my site on twitter, my widget appear under the tweet, like below:
UPDATE 2012-06-13
It appears this is an Expanded Tweet - -what the requirements are to integrate these expansions into Twitter are do not appear to be displayed - but this sure is interesting.
Nope your in luck. They're not hardcoded into Twitter, they're available in the JSON response. You actually have in your post the word you need to google for entities.
You can add include_entities=1 to the end of most REST api calls and it will give you expanded information about the URL's contained within the JSON. It will split out all the URL's where you can parse out the Youtube links for example. The JSON also includes a special media_url entity but it only works for pictures. In any case, you can still parse out the media easily like youtube with a regex match because you get the URL's split out nicely with this include_entities=1 parameter.
example call :
http://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitterapi&include_entities=1
more documentation : https://dev.twitter.com/docs/tweet-entities
answer edited below based on clarification:
Editing Twitter itself with previews is impossible and it's also ineffective. 75% of traffic to Twitter happens outside of Twitter.com. However the most probable solution to achieving this request would be to download a browser extension.
This extension for example enbales previews of webpages directly in the users stream content preview pane on Twitter.com
https://chrome.google.com/webstore/detail/oijgblonhcagdhfbgjilnpjipmijimmn

maximum length of bit.ly generated url, "http" and everything included

full explanation:
I'm working on a project to generate twitter links that post over to twitter. My problem is twitter doesn't shorten the text correctly, and asks the user to fix the text. So I'm going to have javascript shorten the text to the maximum allowed without the extra being cut off by the user or twitter.
That's an unknown number because bitly will add characters as the namespace runs out. So it might be 21 today but 22 in a year. You may need to create the bitly links yourself before posting to Twitter.
This page tells you how to retrieve the current maximum length of a t.co URL generated by Twitter in real time, as part of a JSON string returned via a RESTful HTTP interface:
Twitter RESTful API Description
The relevant values shown for the sample request (YMMV) are:
"short_url_length_https": 23
"short_url_length": 22
These values will change (increase) monotonically over time, as Twitter runs out of combinations to represent the number of URLs submitted (and shortened) thus far.
According to this FAQ from Twitter:
https://dev.twitter.com/docs/tco-link-wrapper/faq
"The maximum length of t.co URLs will change over time. Issue a request daily to GET help/configuration and examine the fields short_url_length and short_url_length_https to determine the current maximum length of wrapped URLs. We do not expect these values to change often."
If your users are providing their own large links, Twitter should now shorten these correctly. At the time of your post, there might possibly have been some problem with that, but at the present time I think that this is working correctly.
However, you might want to provide more meaningful-looking shortened URLs, and Twitter supports this with something called Tweet Entities. I have not used these myself, but here is a link describing them:
Tweet Entities

What does "?ref=ts" mean in a Facebook application URL?

When Facebook drives traffic to an application, it often append &ref=whatever to the query string. This is useful for figuring out which integration points are working or not. I've figured out what some of these mean. For example:
ref=bookmarks - the user clicked on a bookmark.
ref=game_my_recent - the user clicked on the upper portion of the games dashboard.
What does "ref=ts" mean? It accounts for a ton of traffic. I've viewed source on pages all over common Facebook pages and cannot find a match for ant piece of content generated by any of my applications.
Same question, posted by me on the Facebook developer forum:
http://forum.developers.facebook.com/viewtopic.php?id=54866
It means 'Top Search' (if you enter a query into the top, and then click on something, it will append ref=ts
As noted, ref=ts is appended to the url whenever a user makes a search in the Top Search input field.
Also note that people tend to copy/paste links in their website and blogs, without trimming useless GET strings.
So it is possible if you get a high number of referrers coming from the top search that they are in fact links that propagate outside of Facebook.

Resources