Showing posts with label Templates. Show all posts
Showing posts with label Templates. Show all posts

How to Embed a YouTube Video with Sound Muted

It is easy to embed YouTube videos in your website. You grab the default IFRAME embed code, paste it anywhere inside your web page and you’re done. YouTube offers basic customization – you can modify the player dimensions or hide the YouTube branding – but if you would like to exercise more control over the  behavior of the embedded player, YouTube Player API is the way to go.
This tutorial explains how you can embed a YouTube video that will automatically play when the web page is loaded but with muted audio.
For instance, a products website may use short screencasts to highlight features and these videos will autoplay when the page is loaded. The volume is however set to 0 and the user can manually click to un-mute the video. Similarly, if you are using YouTube video backgrounds, it makes more sense to embed muted videos that run in a loop.

Embed YouTube Player with Autoplay and Sound Muted

See the demo page to get an idea of what we are trying to do here. The page loads, the video plays but with the audio slide is all the way down.
This is easy. Go the YouTube video page and note down the ID of the video from the URL. For instance, if the YouTube video link is http://youtube.com/watch?v=xyz-123, the video id is xyz-123. Once you have the ID, all you have to do is replace YOUR_VIDEO_ID in the following code with that string.


  1. <div id="muteYouTubeVideoPlayer"></div>
  2.  
  3. <script async src="https://www.youtube.com/iframe_api"></script>
  4. <script>
  5. function onYouTubeIframeAPIReady() {
  6. var player;
  7. player = new YT.Player('muteYouTubeVideoPlayer', {
  8. videoId: 'YOUR_VIDEO_ID', // YouTube Video ID
  9. width: 560, // Player width (in px)
  10. height: 316, // Player height (in px)
  11. playerVars: {
  12. autoplay: 1, // Auto-play the video on load
  13. controls: 1, // Show pause/play buttons in player
  14. showinfo: 0, // Hide the video title
  15. modestbranding: 1, // Hide the Youtube Logo
  16. loop: 1, // Run the video in a loop
  17. fs: 0, // Hide the full screen button
  18. cc_load_policty: 0, // Hide closed captions
  19. iv_load_policy: 3, // Hide the Video Annotations
  20. autohide: 0 // Hide video controls when playing
  21. },
  22. events: {
  23. onReady: function(e) {
  24. e.target.mute();
  25. }
  26. }
  27. });
  28. }
  29.  
  30. // Written by @Allsoftlearn
  31. </script>
Next place the edited code in your web page and the embedded video would automatically play but the sound is muted.
You can further customize the player by modifying the various player variables as commented in the code. For instance, if you set loop as 1, the video will play in a loop. Set fs to 1 to show the fullscreen button inside the video player. Internally, the player is embedded using the YouTube IFRAME API. When the page is loaded, the onReady event runs that mutes the video.

                   The embedded YouTube video will autoplay, but muted.

How to Display Alternate Content to AdBlock Users

Ad blocking software like AdBlock and Ghostery are installed on millions of computers and thus affecting the bottom line of web publishers who are dependent on online advertising networks like Google AdSense to pay their bills. It takes time and effort to maintain a website but if the visitors are blocking ads, the revenues are reduced. Ars Technica says this is equivalent to running a restaurant where people come and eat but without paying.
As a website publisher, you have a few options. You can detect Adblock on the visitor’s computer and hide your content if the ads are being blocked. That’s going too far but you may ask for donations (OK Cupid does this) or request social payments (Like or Tweet to view the whole page) from AdBlock users.
The other more practical option is that you display alternative content to people who are blocking ads. For instance, you may display a Facebook Like box or a Twitter widget in the place of ads, you may run in-house ads promoting articles from your own website (similar to Google DFP) or you may display any custom message (see example>>>)
to the visitor.




Before we get into the implementation details.  It contains regular AdSense ads but if you are using an Ad blocking software, a Facebook Like box will be displayed inside the vacant ad space.


It is relatively easy to build such a solution for your website. Open your web page that contains Google AdSense ads and copy-paste the following snippet before the closing
tag. The script looks for the first AdSense ad unit on your page and if it is found to be empty (because the ads are being blocked), an alternative HTML message is displayed in the available ad space.
You can put a Facebook Like box, a YouTube video, a Twitter widget, an image banner, a site search box or even plain text.

  1. <script>
  2. // Run after all the page elements have loaded
  3. window.onload = function(){
  4. // This will take care of asynchronous Google ads
  5. setTimeout(function() {
  6. // We are targeting the first banner ad of AdSense
  7. var ad = document.querySelector("ins.adsbygoogle");
  8. // If the ad contains no innerHTML, ad blockers are at work
  9. if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
  10. // Since ad blocks hide ads using CSS too
  11. ad.style.cssText = 'display:block !important';
  12. // You can put any text, image or even IFRAME tags here
  13. ad.innerHTML = 'Your custom HTML messages goes here';
  14. }
  15. }, 2000); // The ad blocker check is performed 2 seconds after the page load
  16. };
  17. </script>
One more thing. The above snippet only detects blocking of AdSense ads and replaces them with alternate content. The process would would however not be very different for BuySellAds or other advertising networks.

Find How Many Visitors Are Not Seeing Ads on your Website

Adblocking software like AdBlock Plus have become mainstream and now pose a significant threat to web businesses that are dependent on online advertisements. The problem is so severe that Google and Amazon are paying the writers of AdBlock Plus to whitelist their ads. This may be seen as some kind of extortion but with billions of dollars at stake, the advertising companies have chosen to take the more profitable route.
It is estimated that ~5% of website visitors are blocking ads (PDF report) and the situation could be far worse for websites that have a more tech-savvy audience. If you are curious to know how many people visiting your own site are blocking AdSense and other ads, here’s a little trick.

Track Adblock Users with Google Analytics

Open your website template and copy-paste the snippet below before the closingbody. This code will detect the presence of adblocking software on the visitor’s browser and, if found, an event gets logged into your Google Analytics account.
  1. <script>
  2. window.onload = function() {
  3. // Delay to allow the async Google Ads to load
  4. setTimeout(function() {
  5. // Get the first AdSense ad unit on the page
  6. var ad = document.querySelector("ins.adsbygoogle");
  7. // If the ads are not loaded, track the event
  8. if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
  9.  
  10. if (typeof ga !== 'undefined') {
  11.  
  12. // Log an event in Universal Analytics
  13. // but without affecting overall bounce rate
  14. ga('send', 'event', 'Adblock', 'Yes', {'nonInteraction': 1});
  15.  
  16. } else if (typeof _gaq !== 'undefined') {
  17.  
  18. // Log a non-interactive event in old Google Analytics
  19. _gaq.push(['_trackEvent', 'Adblock', 'Yes', undefined, undefined, true]);
  20.  
  21. }
  22. }
  23. }, 2000); // Run ad block detection 2 seconds after page load
  24. };
  25. </script>
The snippet works for both Universal Analytics and the older version of Google Analytics tracker that used the _gaq object. As a web publisher, your only option is to serve alternate content to AdBlock users so the visitors at least see some content in place of the ads.
One big caveat though – it will fail if the ad blocking extension installed on the visitor’s computer has blocked Google Analytics as well. Some of the popular choices like μBlock, NoScript and Ghostery do block Google Analytics so the approach won’t work and you may have to build your own in-house solution – like downloading an image hosted on your own server and then counting the hits to that image through the Apache server logs.

The Best Websites to Learn Coding Online

The Learn to Code movement has picked up momentum worldwide and that is actually a good thing as even basic programming skills can have a major impact. If you can teach yourself how to write code, you gain a competitive edge over your peers, you can think more algorithmically and thus can tackle problems more efficiently.
Learn Programming
Don’t just download the latest app, help redesign it. Don’t just play on your phone, program it. — Obama.
There’s no reason why shouldn’t know the basics of coding. You can automate tasks, you can program your Excel sheets, improve workflows, you can extract data from websites and accomplish so much more with code. You may not be in the business of writing software programs but knowing the basics of coding will help you communicate more effectively with developers.
Gone are the days when you had to enroll in expensive computer training classes as now exist a plethora of web-based courses that will help you learn programming at your own pace in the comfort of your web browser.

The Best Sites to Learn Programming

If you are ready to take the plunge, here are some of the best websites that offer courses in a variety of programming languages for free. I have also added a list of companion ebooks that will give you a more in-depth understanding of the language and they don’t cost anything either.
Online Courses & ScreencastsProgramming Books (Free)
JavaScriptCode AcademyLearn Street,Code CombatCode AvengersEloquent JavaScript,JavaScript Guide,Speaking JSJS The Right WayOh My JS,Canvassing
HTML & CSSCode AcademyDon’t Fear The InternetTutsplusLearn LayoutA to Z CSSDashWeb AccessibilityThe Hello World,Khan AcademyHTML5 from ScratchMozillaDive into HTML520 Things I LearnedHTML Dog,HTML & CSSHTML5 for DesignersDOM EnlightenmentHTML Canvas
jQueryCode AcademyTutsplusCode SchooljQuery Fundamentals,Learn jQuery
PythonCode AcademyGoogleLearn StreetPython Tutor,IHeartPYPython for You and Me,  Dive into PythonLearn Python the Hard Way,Think PythonPython for FunTango with Django,Django
Ruby & Ruby on RailsCode AcademyTryRubyCode LearnRailscastsRubymonk,Learn StreetWhy’s (Poignant) Guide to RubyLearn Ruby the Hard WayLearn to ProgramLearn Rails by Example
PHPCode AcademyPHP Programming,Practical PHP
Also see: How to Learn Regular Expressions (RegEx)
Google Apps ScriptGetting StartedOffice HoursGoogle Scripts Examples,Learning Apps Script
WordPressTreehouseWordPress TV
Linux & Shell ScriptingStanford.eduExplain ShellConquer the Command Line
Node.jsNodetutsNode SchoolThe Node Beginner Book,Mixu’s Node bookNode Up and Running,Mastering Node.js
Angular JSCode SchoolEgg HeadLearn AngularAngular JS Tutorial,Thinking Angular,Angular TutorialGetting Started (Adobe)
Also see: Learn Touch Typing & Code Faster
Git (version control)Code SchoolGit Immersion,GitHub TrainingUdacityPro GitLearn GitGists in Github
Objective-C (iOS & Mac)Code SchoolStanfordiTunesU
Chrome Dev ToolsCode SchoolDev Tools SecretChrome Dev Tools Tutorial,UdacityBuilding Browser Apps
Go LanguageGolang.orgGopherCastsProgramming in GoGo by ExampleLearning Go,Building Web Apps with GoLearning Go
JavaLearn JavaCoding BatJava UdemyLearnerooProgramming in Java,Thinking in JavaO’Reilly Learning JavaThink JavaJava & CSJava for Python Devs
Android App DevelopmentUdacity (Google Developers), CourseraThe New Boston,Google UniversityApp Development EssentialsCode Learn,App Inventor (Visual)
D3 (data visualization)Data Visualization for the WebDashing D3D3 Tips & Tricks
Also see: Learn VIM, the text editor for programmers
SQL (Databases)SQL ZooSQL @StanfordEssential SQLSQL for Nerds,Intro to SQLSQL BoltPHP & MySQL
Everything ElseUdacityedX.orgCourseraUdemy$Lynda$Pluralsight$,Treehouse$Open ConsortiumOne Month Rails$

Teaching Kids to Code

If there are kids in the family, you should download either Tynker (Android/iOS) or the Hopscotch app for iPad and they can learn the basics of programming through games and puzzles.
There’s also Scratch, an MIT project that allows kids to program their own stories and games visually. Scratch is available as a web app or you can download it on your Mac/Windows/Linux computer for offline use. Microsoft TouchDevelopBlockly and Alice are some other web apps that will introduce the concepts of computer progamming to your children.
On a related note, the following chart from Google Trends shows the relative search popularity of various programming languages over the last 5 years. The interest in PHP has dipped over the years, JavaScript has more or less maintained its position while the popularity of Python & Node.js is on the rise.
Popularity of Programming Languages

Newsgator vs Bloglines vs Google Reader

Here, we are comparing the three most popular web-based RSS readers - Newsgator Online Web Edition, Bloglines and Google Reader. All of them are server-based aggregation systems. 

For our comparison, we created a new account in each of the services and imported the CNet's Blog 100 OPML Source File [#The scores for comparison categories are mentioned in brackets.

Setting up a New Account:
Bloglines and Google Reader require an email address to create an account that also becomes your login. Your email is verified before you can start using these services. In Newgator Online, the username and email address are different. The e-mail address is also not verified. (NG: 5, GR: 4, BL: 4)

Adding New Feeds:
All these services allow importing of OPML file or directly adding new feeds by specifying the URL. Google Reader was faster than Newgator and Bloglines when importing new content from the OMPL file. During the Import process, only Newsgator lets you further select or deselect feeds mentioned in the OPML file. Bloglines and Newsgator imported all the feeds without giving any such option. (NG: 4.5, GR: 4, BL: 4)

Navigating the Feeds:
Unlike Newsgator Online, Bloglines and Google reader support shortcut keys. With a single key, you can mark the entire session as read. Or open the original post in a new window. (NG: 2, GR: 4, BL: 4.5)

User Interface:
Bloglines displays information in two HTML frames - the left pane has all the feeds listed while the right pane shows corresponding posts, search results and other tips. Newsgator sports a similar interface to Bloglines but it scrolls both the panes together. This gets annoying particularly when a feed has long posts or lot of posts. Google Reader has a very different interface based on Ajax technology . It shows individual posts title on the left pane and the actual post on the right pane. To read a post, you will need to click it. I like Bloglines simple yet uncluttered interface. (NG: 3, GR: 4, BL: 5)

Finding New Source:
All these three services provide a search feature. In my comparison, I searched for feeds related to "Google" - Most of the search results in Newsgator were irrelevant. Even the Official Google blogs were missing in the search results. Google, as expected, wins by a huge margin, both in terms of relevance and freshness of content. Though Bloglines results were disappointing, Bloglines is the only service that lets you limit your search to your subscriptions only. (NG: 1, GR: 5, BL: 2)

Customization Features:
In Bloglines, you can choose either to view complete entries or Summaries or Titles only. You can also attach notes to individual feeds. Google Reader uses labels. Bloglines provides multiple options for sorting feeds. You can filter items in Bloglines based on the time the item was published. In Google Reader, feeds can be filterned based on labels or Title of the feed. (NG: 2, GR: 3, BL: 4)

Other Good Features:
Newsgator Smart Feeds let you track reference to any URL. This is a feature similar to the Google link: syntax. 

Both Newsgator and Bloglines display the number of subscribers associated with each feed but Bloglines even goes a step further, it displays the list of public subscribers. Google has no such option till now. 

Bloglines let you create a custom blog (hosted on Bloglines) to store and share your clippings and favorites. Clipping facility is available in Newsgator also but Bloglines provides a nice WYSIWYG editor for further rich-editing of clips. (NG: 2, GR: 2, BL: 4)

Conclusion:
Here are the final scores:

Google Reader: 26
Bloglines: 27.5
Newsgator Online Web Edition Free: 19.5

Bloglines wins but Google Reader, still in beta, is close. Google Reader outperformed everyone when searching for new content but Bloglines interface and usability make it a big winner.

Which Adsense Format and Color Scheme Performs Best

Should I use the 300x250 Adsense Rectangle or the much wider 336x280 for maximizing clicks? What do I select - 4 or 5 ads per adlink unit ? Will text only ads perform better than text+image ads ? Should I hide the colored border ?

These are some very common questions among web publishers especially those who have just gained admission to the University of Adsense. While the answer is to keep on experimenting, most Adsense experts employ a simple technique called "AB Split Testing" to optimize their Adsense ads.

The basic idea is to display different Adsense formats at the same location simultaneously but randomly. [This is done using the random() function in Javascript that generates a number between 0 and 1 with equal probability]

Here's a sample scenario to help you determine what format works best for your site - 300x250 or 338x280 ?

Step 1: Create two custom Adsense channels - name them as 300x250 and 336x280.

Step 2: Generate the Adsense Javascript code for each of these Adsense formats. Everything will be common in two code snippets except the value of following variables: google_ad_channel, google_ad_width, google_ad_height and google_ad_format.

Step 3: This is an important step, you will merge the two Adsense snippets in such a fashion that each makes an appearance on your web pages nearly 50% of the time. Here's a sample code:


<script type="text/javascript">
 var google_ads = Math.random();
    if (google_ads < .5){
      google_ad_channel = "300x250Channel";google_ad_width = 300;
      google_ad_height = 250;google_ad_format = "300x250_as";
    } else {
      google_ad_channel = "336x280Channel";google_ad_width = 336;
      google_ad_height = 280;google_ad_format = "336x280_as";
    }
      google_ad_client = "pub-xxx";google_ad_type = "text_image";
      google_color_border = "FFFFFF";google_color_bg = "FFFFFF";
      google_color_link = "0000FF";google_color_text = "000000";
      google_color_url = "0000FF"; 
</script>
<script type="text/javascript" 
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Monitor the performance (CTR, eCPM) of the two Adsense channels for a week or two to know which of the two Ad formats are converting better. [Switch to Advanced reports, select the two Adsense for Content channels and group by both date and channel]

In the next iteration, you may try the same trick with two different color schemes but keeping the Ad format same - just create separate Adsense channels for each color scheme.

If you are displaying Adsense ads on the homepage of blogs or other places where content changes very frequently, it's a good idea to test between Text and Text+Image ads

The contextual ads may not be very relevant on blog homepage or archives because of the dynamic content and therefore CPM based Image ads may bring in more revenue.


Google Domains

Gary Price of Resourceshelf published the complete list of 400 recently registered Google domains (none owned by Google). Most of the domains are up for-sale or for some sales trick. 

One of these viz. www.Googleiche.com, routes to http://www.nichebot.com/g/ - a keyword suggestion tool?. 

How to Enable Google Plus Commenting on BlogSpot Blogs

Long time back, Google announced about Google plus commenting system, and now it’s finally available for BlogSpot blogs. Compare to default blogger commenting system, Google plus commenting system gives you more power to go social, and will help you to build a better community around your BlogSpot blog. If you have a blogger enabled blog, you should consider enabling Google plus comment system on your blog.  This guide will help you to get started.
There are two steps which you need to do:
  • If you have not integrated your blog with Google plus before, you need to integrate it.
  • Enable Google plus comments
I highly recommend you to migrate your existing commenting system on BlogSpot to Google plus. Before you do so, do read following points:
  • If you change your blog URL, your existing Google + comments will disappear. So, if you are planning to get a custom domain name for your BlogSpot blog, you should get it, before migrating to Google plus commenting system.
  • If you are using 3rd party commenting system like DISQUS, you will lose all the comments.  If you are using Blogger default commenting system, you will be able to retain all your comments.
  • If your readers don’t have a Google plus profile, he will not be able to comment. Though, he will be prompted to create one. One big cons of Google+ commenting system.
  • If your blog have adult nature content (mature content), you will not be able to use Google+ commenting system. (grayed comment box)
  • If you are using custom BlogSpot template, you can get code from this page to add Google plus comment box.
I will explain the complete procedure, and features of Google+ comments for BlogSpot blogs below.

How to connect BlogSpot blog to Google plus:

Login to your BlogSpot dashboard, and click on blog for which you want to connect to Google plus account. This will also help you to get Google authorship for your BlogSpot blog, or you could directly publish about new posts to your Google plus profile, or to your Google plus page. You can find more information on official help page here.
Once you are inside your BlogSpot dashboard, click on Google plus on left sidebar. On the page, click on get started:
Integrate Google plus BlogSpot Blog
Before you make the switch, do remember your profile information from Blogger will not be migrated to your Google plus profile. So, before making the switch, copy the profile information from your Blogger profile to Google plus.
migrate Google plus blogger
Now, click on Switch now, and your blogSpot blog is linked to your Google plus profile. On the next page, you can select the box to add the blog in your profile, which you should do, if you wish to take advantage of Google authorship (Profile picture in Google search).

Enabling Google plus Comment system on BlogSpot blog + Features:

First lets look at features & benefits of enabling Google+ comments on your Blog:
  • More Social media interaction:  One direct benefit is, more social media interaction and social media signals. Since, social media signals is one of the major ranking (SEO) factor, it will help you to improve your overall blog traffic.
  • No login: Usually most of the users are using Google services, and if your readers are already logged into their Google account, they don’t need to add any details like Website address, Name-email to comment on. This will also help BlogSpot bloggers to get more comments on their blog post.
  • More comments: When people will comment on linked post on Google plus, those comments will automatically be displayed on original blog post, and vice-versa. This will also encourage blogspot bloggers to be extra active on Google+. Smart move Google!.
Now, if you have associated your BlogSpot blogs with your Google plus profile, you can quicklyenable Google plus comment system on your blog. Go back to Google plus link under your blog dashboard, and select the option which says “Use Google+ comments on this blog”.
Google plus commenting system
Here is your updated comment box will look like:
Google+ comment
Over all, Google plus commenting system has more pros than the cons. The tough decision is for old bloggers who are blogging on BlogSpot platform for long, and using 3rd party commenting system. From future perspective, Google plus commenting system is good and have many advantages for your blog, but if you are considering to switch to WordPress in near future, you might not want to use Google plus commenting system.