Tweet What You Want Code on Search Engine Land

I recently wrote an article on Search Engine Land and wanted to make sure I posted the code in other places as well in case anyone missed it.

Basically, the code is used to make sure you decide what users tweet.

This is a quick work around that I came up with and my friend Josh (my go-to developer) who helped me put it together.

Simply install this code in the place where you would place a Twitter share button:

<a href=”#” onclick=”tweetSelectedText()”><img src=”https://digitalhighrise.com/wp-content/uploads/2012/05/tweet_button.gif” border=”0″ /></a>

       <script type=”text/javascript” src=”http://code.jquery.com/jquery-1.7.2.min.js”></script>

       <script type=”text/javascript”>

       $().ready(function(){$(‘.tweetThis’).hide();});

       function tweetSelectedText(){

               var twtTitle = $(‘.tweetThis’).text() || $(‘title’).text();

               var twtUrl = location.href;

               var maxLength = 140 – (twtUrl.length + 1);

               if (twtTitle.length > maxLength) {

                       twtTitle = twtTitle.substr(0, (maxLength – 3))+’…’;

               }

               var twtLink = ‘http://twitter.com/home?status=’+encodeURIComponent(twtTitle + ‘ ‘ + twtUrl);

               newwindow=window.open(twtLink,’name’,’height=500,width=500′);

               if (window.focus) {newwindow.focus()}

       }

       </script>

Then, in the code of your post (beginning or end, it doesn’t make a difference) add this tag:

<p class= “tweetThis”>THIS IS WHERE YOUR MESSAGE GOES</p>

In this tag, you can craft your own message, which is descriptive, contains the targeted keywords and utilizes the allotted space.

 

And that’s it. Hope that helps 🙂

 


Posted

in

, ,

by

Tags:

Comments

One response to “Tweet What You Want Code on Search Engine Land”

  1. […] ג'ון ברג – לפני שפותחים חשבון עסקי בטוויטר צריך לחשוב מה צרכי העסק ועל מה הציבור מדבר – טוויטר אינו אלא חדר צ'אט אולייני. צריך לחשוב מה ניתן להפיק מהדיבורים הללו ברשת. – חובה להגדיר ציפיות ולהבין מה הייחודיות של העסק. על העסק להוות פתרון! – חובה להגדיר הצלחה – נכון שקשה למדוד את הפעילות טוויטר אך עדיין צריך להגדיר ציפיות (אנשים ידברו אחרת על המותג / מודעות / הכרה) ובהתאם להחליט איך למדוד את הוצאתן לפועל (יותר פוסטים חיוביים / יותר אנשים מדברים על המותג וכן הלאה). אהרון פרידמן – תוכן הציוצים (tweets) יושפע ממה שאנשים מחפשים והנושאים עליהם הם מדברים. לשם כך יש לבדוק את האנאליטיקס, טרנדים וכדומה. – יש microdata לציוצי טוויטר המאפשרים הצגת משהו הדומה ל-rich snippet של גוגל. כדאי להשתמש בזה. – ניתן לשנות את הודעת הטוויטר מדי יום לשם משיכת קהלים שונים. ראו את הקוד במאמר הבא. […]

Leave a Reply

Your email address will not be published. Required fields are marked *