Categories
WordPress

Tutorial: How to add Google Analytics to WordPress

Step 1. Sign up for Google Analytics

Sign up for Google AnalyticsStep 2. Add a New Account

Once you are logged into Google Analytics:

Create New Analytics Account

    1. Click + New Account.
    2. On the Create New Accountpage, under General Information, enter your account name and the URL for your web property. You may see that the Account Name field has a default value of the URL for your web property. You can change that value to something more meaningful.
    3. Under Data Sharing Settings, select the data-sharing options you want.
    4. Under User Agreement, select your country or territory from the menu, read the terms of service, then select the check box for Yes, I agree to the above terms and conditions
    5. Click Create Account.

Step 3. After creating your account you will see your tracking code. Copy your analytics code for later use.

Google Analytics tracking code

 

Step 4. Add code to WordPress

I will be using the functions method.

      1. Login to your WordPress admin.
      2. Expand the Appearance tab and click Editor on the menu.
  • In the Edit Themes page you will see a list of files on your right. Click functions.php
  • Now on the top of the functions.php file below the comments add this code. Remember to paste your Google Analytics code from Step 3 here.
add_action('wp_footer', 'add_googleanalytics');
function add_googleanalytics() { ?>
	// Paste your Google Analytics code from Step 3 here
<? }

Now you have installed Google Analytics to your WordPress site. It takes 24 hours for Google Analytics to start showing your results. Log into your Google Analytics account in the next couple of days and you will see your traffic stats.


Categories
CSS

Tutorial: Force text to line wrap using CSS

Here is a problem I face occasionally. When displaying a long line of code, like the full URL of a link, the text can be wider than the containing div and instead of wrapping the text goes beyond the edges of its containing div which looks ugly.

Example:

Solve this by simply adding the following CSS property to your div’s CSS style

.wordWrap { word-wrap: break-word; }

Now the text will wrap nicely within your div container.

 

Categories
Downloads

TinyMCE with image uploader TinyBrowser download

Download the full package of TinyMCE with everything needed here.

Previously I have used CKeditor for web applications and content management systems that I build. However, I became frustrated with how heavy CKeditor is. So I decided to give TinyMCE a try. Within an hour I realized that I loved it. However, it has two major downfalls. One it is very ugly. Two It does not come with a built in image browser and uploader.

Thanks to the hard work of others, both of these problems have been solved nicely. I did some research online and came across an article by thebigreason where he has kindly created a nice looking skin and is offering it for free.

Original Skin, Ugly and Busy
Clean Skin

Then I needed an image browser and uploader. TinyMCE does not include one in their download, but would prefer that users pay for it. That is fine, but I checked around online to see if any free plugins were available. I came across a great review of all the available free image management plugins for TinyMCE by Tysen. After first reading about them, I decided to test a few out myself, and quickly came to the conclusion that I prefered TinyBrowser. It seems to integrate the best into TinyMCE, is very easy to implement and has a nice user interface.

To use TinyBrowser and Thebigreason Skin simply copy the code below. I have included a working demo in the examples/ folder within the TinyMCE download.




Download the full package of TinyMCE with everything needed here.

If people are interested I will create a short tutorial on how to install TinyMCE and set TinyBrowser up.

Categories
On Business

Life lesson #1: What do you need to do to succeed in business? You need to be inspired.

I wrote this article a couple years ago and thought it was worth posting as my first post on this blog because I still find this very relevant to my success in business.

Not that long ago I learnt an important lesson: know what inspires you. With regards to business there are a lot of books on the topic of motivation, but not too many on inspiration. When starting a clothing company a few years back I began reading lots and lots on business. I read books on leadership, economics, small business, marketing etc. Being the keen student I was I began to follow the rules to success religiously (as they were outlined by the numerous books on the topic). Obediently I developed product workflow, marketed my products, studied my customer, found a niche, and developed the brand. As the sole designer for the clothing company its identity and ‘edge’ was hinged on my design ideas. And then one day, out of the blue, the ideas stopped. I worked harder to come up with new ideas, but it felt like I was squeezing water from a stone. WHAT HAPPENED? I had done everything right hadn’t I?

In short I had lost my inspiration. As I was personally funding the company I began to shop less, focused on redirecting any income I had back into building the company. Shopping less meant I wasn’t buying as many clothes for myself. For me buying clothes inspired me, I would look for a shirt and then start thinking, ‘Oh if only they made it this way, or with a different design’. Ironically the thing that I had stopped doing was the very life blood of the ideas that spurned on the company.

I began to refocus the direction for the company as my ideas for new designs had all but disappeared. During this process I took some time off and started shopping more. Then a lightbulb came on. Ideas began flowing quickly again and I realized what had happened. Fast forward to the present, I have since moved on from the clothing industry, and am working on a few internet related businesses. I have come to the conclusion that for myself inspiration is as important for every business endeavor I work on as is the motivation that keeps driving them. For this reason I am somewhat surprised that there isn’t more written on this topic.

In summary I have learnt that for me to remain successful and creative I must find what inspires me. And then using this knowledge, create situations where I am inspired. For some that might mean taking more time to walk in a forest and for others it could mean simply reading a book or a magazine, whatever it is, find what inspires you and make a point of doing it, it may mean the difference between success and burnout.