I am using the Twitter share button from my website to generate a tweet with a card. When a user clicks on the tweet with the card, the user is directed to the web page where the share button was pressed. I want the user to go to another page when the tweet is clicked. I can not find a way to do this? Please advise. Thank you.
A card appears on a tweet based on the <meta> tags on the html of the site, so the card will appear if the tweet text contains a link. You can use a 301 redirect to a different url on your site, but remember that the twitter bot that loads cards also follows redirects, so the final page that a person would land on would have to have the meta tags for the twitter card. Getting started with Cards | Docs | Twitter Developer Platform
1 Like
I am not being clear enough on this. The user clicks a twitter share button on a web page and a tweet with a card is created. The user then tweets the post. The URL associated with the published tweet on twitter is the URL on the page where the twitter share button is located. I want the URL to be different than the URL on the page where the twitter share button is located. I have now been able to do this using the twttr.widgets.createShareButton() function, but I am not sure if this is the correct or only way to do this? I’d also like to be able to create my own Share button using CSS.
I found another way besides the use of the twttr.widgets.createShareButton() function. I simply used the html code twitter publishes but with a slight modification using data-url. This seems to be supported but I am not sure if I will run into compatibility problems later since I couldn’t find this exact suggestion in the Twitter developer documentation. Hopefully someone more knowledgeable will comment.
<a class=“twitter-share-button” href=“https://twitter.com/intent/tweet” data-url=“[substitute the url with any paramerters you want your user to go to when the user clicks on the tweet]” data-size=“large”>
While these two methods seem to work well, I’d still like to be able to control the Twitter Share button CSS. Any thoughts? Please advise. Thank you.
1 Like
system
Closed
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.