Interactive by Nature

Adobe Analytics Serialize Event With Variable Value

Monday, May 2nd, 2016

NOTE: This post assumes you know a lil somethin’ somethin’ about Adobe Analytics, formally known as Omniture.

Recently I had the need to serialize an event with the value of a DTM Data Layer. Doing an internet search did not bring up anything nor was Adobe Analytics Methods of Event Serialization documentation helpful. Serializing an event is pretty straight forward.

Here’s the syntax for serializing an event:

s.events="[event]:[serial number]"

If you need to serialize an event with the value of a variable, here’s the code for that:

var myVariable = digitalData.someInfo.somethingSpecific;
s.linkTrackEvents='event1';
s.events='event1:'+myVariable;

Posted in Analytics, Code, Development | No Comments »

Motion UI For Foundation Mobile Menu

Monday, September 22nd, 2014

Lately, I’ve been seeing some chatter about Motion UI. Motion UI is the practice of using subtle animation to give affordance in a User Interface. With Flat Design in full effect, sometimes context can be absent from the UI. Motion helps the user to realize what just happened or where they just came from, thus providing a better User Experience.

What surprises me about Foundation 4 & 5 is that there’s no animation options for their mobile Top Bar menu. By tapping on the Top Bar hamburger menu icon, the menu list snaps open! This can be jarring to the user, so I decided to add a subtle transition easing effect while opening and closing the menu.

Out-of-the-box, Foundation sets a height of 45 pixels on the .top-bar element. You will need to change this property to max-height. I’ll explain later. After you do that, then add the transition CSS as seen below.

.top-bar {
  max-height: 45px;
  -webkit-transition: max-height .3s ease-in-out;
  -moz-transition: max-height .3s ease-in-out;
  -o-transition: max-height .3s ease-in-out;
  transition: max-height .3s ease-in-out;
}

(more…)

Posted in Code, Design, Mobile | No Comments »

Media Queries For HTML Elements

Thursday, July 17th, 2014

Problem

Recently, I needed to reuse some markup for a component. The markup to be reused was to be put inside a modular, HTML component in a side panel of our application. Alternatively, it was the main content on another page. The problem is that the component needed to respond to the width of the side panel, which only took up 2 columns of an 8 column grid. So, basically I needed that media query to display the “mobile view” inside that 2 column panel. The CSS styles for the mobile view cannot be rendered unless the media queries conditions were met. I used the same markup for the side panel, but without the media queries firing off, the layout was not stacking the way I needed it to (figure 1). My first thought was to have 2 separate HTML snippets, but that’s not practicing modular design, so I started looking for a solution.

Element Queries

figure 1

(more…)

Posted in Code, Design, Development, Mobile, Web Design | No Comments »

Creating Custom Icon Fonts

Wednesday, July 31st, 2013

Benefits of Icon Fonts

I’ve always been obsessed with icons and hieroglyphs, so as a web developer, I got all excited with the sudden popularity of icon fonts. Using icon fonts, as a replacement for images, has many benefits. The most important, in my opinion, is performance. Because icon fonts are vector and are contained in a single file, they perform better then, say, using a sprite as an image container. Although, both a sprite and a font file make a single HTTP request, the icon font file is usually a lot smaller.

Another important benefit of using icon fonts is optimization for high-resolution screens. The media query is a wonderful thing, but if it can be avoided for swapping images for high-resolution screens, it’s a quick win – one file for all screens and device types! Because icon fonts are vector, they will scale without loss of quality and again, when you compare file size and the single HTTP request, it’s a no-brainer.

With icon fonts, it’s also super easy to change color and size using CSS. As browser support for CSS3 becomes more advanced, you will be able to do all kinds of other cool stuff, like apply gradients, drop shadows and background textures.

Getting Started

There are a few icon font generators out there, but I’m using Icomoon because you can import your own vectors, import other icon font packs, only include the icons you need, use the Private Use Area feature, etc. The best part about Icomoon is that it’s 100% free and open!

The first thing you’ll want to do is go to http://icomoon.io/app/. When you first enter the app, you will see icons galore! If the icons that are needed are on the screen, you can simply click to highlight the icons you want. You must make sure that the Select tool is selected, but I’m pretty sure it is by default. There are two other tools available. The second tool is the Delete feature. When selected, it removes the icon from the icon library that displays on your screen. The third tool, is the Edit tool. When selected, simply click on an icon to edit. You will see a pop-up window (figure 1) with the icon you selected and a few features including Rotate, Flip, Scale and Move. You can also download that icon as an SVG. This is helpful if you want to take it into Illustrator and make changes to the icon that wouldn’t be able to made inside of Icomoon.

(more…)

Tags: , , , ,
Posted in Code, Design, Development, Mobile | No Comments »

Considering Browser Reflow

Friday, April 5th, 2013

Back in February I attended the HTML5 Denver Users Group presentation – Making Your UI Scream (Not Your Users) by Wesley Hales. From the title of the presentation you can probably guess that his talk was about website performance. Most of what he had to say about performance, I’ve heard before, but one of the things that Wesley brought up was reflow. I’ve built plenty of websites and performance is always at the top of my list, but I never looked too much into reflow. This was my biggest takeaway from Wesley. Now that performance for mobile websites is a huge consideration, I’ve been interested in other micro-optimizations. Maybe another reason that I haven’t taken reflow into consideration before is because I follow one of Wesley’s rules: Don’t let micro-optimizations weigh you down. Finish the project first.

More On Reflow

Reflow is the process in which the browser calculates the positions and geometries of all the elements in the DOM tree for visual presentation. Reflow is a user-blocking browser operation that can effect the UX, and in this day-and-age of immediate gratification, performance is a very important UX consideration. One of the most powerful things about jQuery is it’s ability to easily manipulate the DOM with methods like .show(), .hide() and .attr(), but in order to minimize reflow you should avoid touching the DOM as much as possible.

(more…)

Tags: , ,
Posted in Code, Development, jQuery, Mobile | No Comments »

Mobile App Training By Apigee

Sunday, March 31st, 2013

Last Friday I attended a free mobile app training session with Apigee. We used jQuery Mobile combined with PhoneGap to produce a rich native mobile application. The training session was led up by Tim Anglade, Head of Developer Programs & Evangelism at Apigee. Tim has an impressive resume and is completely comfortable speaking in front of a crowd.

jQuery Mobile

The first half of the morning was spent introducing jQuery Mobile followed up by a crash-course in using the mobile web UI framework. Tim also introduced a drag-and-drop WYSIWYG called Codiqa to keep things moving for those unfamiliar with jQuery Mobile. Codiqa is great because you can use it as a prototyping tool and share designs with clients and/or collaborators. Having used jQuery Mobile since it’s first alpha release, I chose to open up TextMate and go to town.

(more…)

Tags: , ,
Posted in Code, Design, Development, jQuery, Mobile | No Comments »

How To Embed A Tweet

Wednesday, February 13th, 2013

I read a lot of blogs and often see an embedded tweet and think… how did they do that? Well, I figured it out and I’m going to share this simple process with you. It’s literally just a matter copying a little HTML and pasting it in your blog or web page. If you don’t know what I’m talking about, the embedded tweet looks like this:

This is great because the embedded tweet comes fully equip with Reply, Retweet and Favorite options. It also gives you the option to follow the person that owns the embedded tweet. Any images posted in the tweet will display as well. It’s basically the fully featured tweet that you would see on Twitter or other Twitter applications like TweetDeck.

(more…)

Tags: , ,
Posted in Code, Design, Miscellaneous | No Comments »

301 Redirect Entire Directory

Thursday, January 24th, 2013

Last nite I was up super late moving my blog from /blog/wordpress/ to root/. It was quite the process, but I survived. One of my main worries is that Google has indexed all of my posts and some have been bookmarked by visitors. Instead of those users and Google indexed links being SOL, I needed a way to redirect all users using the old links to the new directory, the root/. Instead of doing a 301 Redirect on each post, I came up with the the following solution.

Add this snippet to your .htaccess file:

RewriteEngine On
RewriteBase / 
RewriteRule ^blog/wordpress/(.*)$ /$1 [R=301,L]

At a high level, when a URL entering my blog contains /blog/wordpress/, it get’s redirected to root/. The $1 takes everything that was after /blog/wordpress/ and adds it to the end of the new URL (root/).

For example:

http://www.interactivebynature.net/blog/wordpress/2011.09.21.breaking-development-in-nashville now becomes http://www.interactivebynature.net/2011.09.21.breaking-development-in-nashville.

You can test it out here:

http://www.interactivebynature.net/blog/wordpress/2011.09.21.breaking-development-in-nashville

How do you handle directory redirects? Let me know in the comments!

Posted in Code, Development | No Comments »

DenverJS

Monday, January 7th, 2013

DenverJS

This month I attended a new meetup called DenverJS that focuses on, you probably guessed it, JavaScript. Being a client-side programmer in Denver, I’m really excited about this one! In this post, I want to briefly review the 2013 kickoff session at Galvanize.

What about DenverJS?

Straight from their meetup profile:

Focused on developing the Javascript community along the Front Range! We welcome any and all interested in Javascript and related technologies. We will be weighted towards node.js and server-side topics to balance out the already awesome Denver HTML5 group.

(more…)

Tags: , ,
Posted in Code, Development, Miscellaneous | No Comments »

AJAX without jQuery

Wednesday, December 12th, 2012

I like to post about problems that I solve so that I can refer back to if I ever encounter the same problem in the future. This time I needed to make an AJAX request without using jQuery. I’ll be honest… I’ve ALWAYS used jQuery for AJAX. Why wouldn’t you? It’s so easy, plus if you’re already using jQuery, it’s more efficient. I didn’t know where to start, but after some research, I came up with the following:

$('#container').on('tap', '#element', function(event) {
	
    //GET URL FROM TAPPED ELEMENT
    var requestURL = $(this).attr('href');
		
    var xmlhttp = null;
    
    if (window.XMLHttpRequest) {
        //IE7+, Firefox, Chrome, Opera, Safari
	xmlhttp = new XMLHttpRequest();
    }
		
    xmlhttp.open('GET',requestURL,true);
    //XMLHttpRequest - I GUARANTEE IT!
    xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 
    xmlhttp.send(null);

    xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState==4 && xmlhttp.status==200) {		
	    document.getElementById('container').innerHTML=xmlhttp.responseText;

	}
    }

    //PREVENT DEFAULT BUTTON BEHAVIOR
    event.preventDefault();
	
});

As you can probably see, I AM indeed using jQuery for the tap event and URL gathering. The jQuery version that this post references is v1.7.1. using the .on() method; the rest is old school javascript. Let’s break it down!

(more…)

Posted in Code, Development, jQuery, Mobile | No Comments »