Tweet button count not working properly with data-counturl that contains hashbang


#1

I have multiple Tweet buttons in the site each one inside a “page” with a different hashbang ( “#!foo/bar”, “#!lorem/ipsum” ) and I’m using the “data-counturl” like: data-counturl="http://example.com/#!foo/bar" (same value as I’m using for “data-url” as well)

I would expect the tweet button to treat them as different pages altogether (since they are indeed different pages on my site) and/or do a request for “?escaped_fragment=foo/bar” and “?escaped_fragment=lorem/ipsum” to detect the redirects instead of simply displaying the tweet count of the index page for all of them.

PS: My application really needs the hashbang since it should work the same way in browsers that doesn’t support the HTML5 history API (update content dynamically and have deep links).


#2

I’m facing the same issue. is there any solution/work-around available?


#3

Though this thread was started 2 years ago this issue still exists. If counturl points to hashbang URL it seems that Twitter considers only base URL ignoring hash fragment.

E.g., if I share these links:
domain.name/path/#!sub-path-1
domain.name/path/#!sub-path-2
domain.name/path/#!sub-path-3

All three shares will be counted for just domain.name/path/ that is wrong.

Is there any workaround/solution for this?


#4

All parts of the URL after the # are not accessible to servers, so we are only able to count URLs up to domain.name/path/, everything after that only exists on the client-side. This is just how URLs work.

You should avoid using document fragments for discrete content paths, and instead use the browser pushState API to allow client-side navigation using full URLs.

Ben


#5