Twitter Share Button Does Not Send Custom Text

I am working on a website with the ability to share Twitter for each specific product.

I followed the twitter API instructions for sharing tweets and everything works fine except for custom text display. For example, I want the user to tweet as follows: "Do you think I should buy this? Http: //url.etc @mywebsite"

but all i get when custom tweets is link: http: //url.etc

This is the code:

<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<a target="_blank" href="https://twitter.com/share" data-url="http://bit.ly/twitter-api-announce" data-via="testtest" data-text="What do you think? Should I buy this? " data-count="none" data-counturl="http://groups.google.com/group/twitter-api-announce" >TWITTER</a>

It seems that the problems are related to the text-to-text parameter.

Any experience on this? Ideas? Thanks

+5
source share
4 answers

In Wordpress, I just used <a href="https://twitter.com/share?url=google.com&text=your text here">Tweet</a>

It works like a charm!

+5
source

just use the link:

<a href="http://twitter.com/share?related=[your_twitter_account]&via=[your_twitter_account]&lang=[fr]&text=[hello%20world]&url=[www.google.com]">tweet</a>

Just change what is between [] (and delete them), note that everything should be RFC (with strange characters such as "space", replaced by% 20, etc.)

twitter offers a nice page for creating buttons https://about.twitter.com/resources/buttons#tweet But my solution avoids javascript to force a bud design

+4
source

:

<a href='https://twitter.com/share?url=google.com&text=Signup>Tweet</a <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');</script>  
+1

, Twitter. Twitter. https://about.twitter.com/resources/buttons

If you want to change the contents of tweetbutton on the fly ... for example, after loading the page, you will have to create and embed your twitter button in the html DOM dynamically.

Some recommendations on this subject can be found here.

http://denvycom.com/blog/twitter-button-with-dynamic-custom-data-text-message/

Hope this helps.

0
source

All Articles