Twitter Button counts remain zero for AJAX-based hash-tag url driven site


#1

I develop a site that uses hash-tag URLs to pull pages via AJAX form the server. These pages have tweet buttons (tried both HTML5 and iframe versions). The tweet buttons draw correctly, but the counts remain zero.

Here’s an example: http://www.daytrotter.com/#!/live/
(It’s been tweeted more then once)

Does the twitter tweet button not work with hash-tag based urls in AJAX-driven sites?

Thank you very much,
-wade


#2

This is a tricky one – it’s technically possible for the Tweet Button to count these URLs, but your server might have to play along with a bit of a rouse. The Tweet Button requires that the specified URL be observable via a HTTP HEAD request… right now, your server returns a 404 Not Found for your URL, so it’s as if it doesn’t exist. You may want to provide an alternate form of your content accessible by a URL format your server can understand and see.

curl -I "http://www.daytrotter.com/\#\!/live/" HTTP/1.1 404 Not Found Date: Mon, 31 Oct 2011 14:52:38 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 15335

#3

Thanks for the relpy!

I do follow the Google spec for AJAX crawlable pages (http://code.google.com/web/ajaxcrawling/docs/specification.html), so there is a ?escaped_fragment=/live/ page (or will be after tomorrow), but I don’t know how to tell Twitter that it can get its HEAD information from there. If I use the counturl to specify the ?escaped_fragment version then the /#!/ version wont have any counts associated with it, right?
For example:
http://www.daytrotter.com/#!/concert/distractions/20055005-3738523
vs
http://www.daytrotter.com/?escaped_fragment=/concert/distractions/20055005-3738523


#4

Try using the verbose URL with the ?escaped_fragment parameter as your data-count-url argument to the Tweet Button like so:

Tweet

#5

I tried using this tag

Tweet

on this page


But alas, the count hasn’t incremented despite me tweeting it twice.

I used curl -I “http://www.daytrotter.com/?escaped_fragment=/content/twitter-test.htm” and got a successful head request

HTTP/1.1 200 OK
Date: Wed, 02 Nov 2011 20:23:23 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 9958

Is there anything else I can try?
Thanks again for your help!


#6

Do you have an example Tweet that you issued for http://www.daytrotter.com/?_escaped_fragment=/content/twitter-test.htm ? I just did a test post and the count has updated.


#7

Holy cow, the count finally incremented! Thank you for your help!
It took all day to see my two test tweets reflected on the page, but now I know how to do it.

I’m sorry my question was so simple to answer, I should have figured it out without bothering you guys. I’m sure you get tired of telling people the same solution involving the HEAD request.

Thanks again!
-wade


#8

No worries, this is a use case which we should probably document better. Please follow up if you see any further issues.


#9

Hi guys I’m having the same problem (sorry for opening this old post, but it’s very relevant).

I did add “escaped_fragment=” to the link, the count never updates, until I tested it by tweeting the link with “escaped_fragment=” not with the hashbang characters, then the counter updates.

At this time, I don’t understand what could be the problem. Any idea?


#10

Hi, we also have a web site which uses AJAX crawlable URLs but our Tweet buttons do never increment,

In our case the URL structure is a little different, for example we have this URL :

http://www.verygoodmoment.com/verybest/see/event/16#!slides?feedback=4333

The corresponding ‘escaped’ form is (this is what Fetch as Google Bot uses) :

http://www.verygoodmoment.com/verybest/see/event/16?_escaped_fragment_=slides?feedback=4333

So, we’ve created the following button :

Tweet

The result of the curl command seems to be good :

$ curl -I http://www.verygoodmoment.com/verybest/see/event/16?_escaped_fragment_=slides?feedback=4333 HTTP/1.1 200 OK Accept-Ranges: bytes Age: 0 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Content-Type: text/html; charset=UTF-8 Date: Sun, 15 Dec 2013 12:38:11 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Pragma: no-cache Server: Apache Set-Cookie: verygoodmoment=sl13fh0nesvafkhgsjombo3381; path=/ Set-Cookie: verygoodmoment=pi7i24jjr9u5l14btdo1rkpgu5; path=/ Vary: Accept-Encoding Via: 1.1 varnish X-Varnish: 99670627 Connection: keep-alive

But the button never increments, I’m wondering if this could be because our URLs have in fact 2 “parameter declarations”, ?escaped_fragment and ?feedback=4333.

Is the URL http://www.verygoodmoment.com/verybest/see/event/16?escaped_fragment=slides?feedback=4333 valid for Twitter ?

Do we are to refactor all our URLs to have something like http://www.verygoodmoment.com/verybest/see/event/16#!slides/feedbacks/4333 and http://www.verygoodmoment.com/verybest/see/event/16?escaped_fragment=slides/feedbacks/4333 ?

Thanks,

Baptiste


#11

#12

#13

#14