26Dec

Maggie

I haven’t updated the blog since August, because I have been really busy since Maggie was born in mid August.

The first few days, it was easier than I thought. But after we came back home from the hospital, it was a lot harder than I expected. Sleeping hasn’t been too bad. Most nights, we only need to feed her once during the night. But raising the first child is always stressful I guess, because you don’t know what’s expected. I remember when Maggie cried really badly for no reason for the first time, I was quite worried that if she was sick or something wrong with her. But that’s what babies do, so a little bit more than 4 months in, I think it is much easier now.
Maggie's first dayAlmost one month old

A bit more than two months old

Maggie started to smile

Maggie is 3 months old

She really like the fan I am holding

First hair cut, I did it ;-)

Christmas

2Aug

Building a Speech Recognition with Python on Raspberry Pi

Recently I spent some money (less than $100) and time to build a speech recognition script with Python which can be run on my Raspberry Pi 2. Since I bought a RPi 2 as my media player, I was thinking to put my old RPi B+ to do something fun. So I started the speech recognition project.

Unfortunately, RPi B+ seems to be just too slow to handle the task. So I ended up buying another RPi 2. The script basically does three things:

1) Convert audio input to text
2) Respond to the text from step 1 and come up with response in text
3) Convert the response text into audio output.

So here are a couple demos I made in the last few days. You might need to turn up the volume to hear what I said in the videos. Let me know what you think.

Demo 1: At this point, the script can only answer the date and the time.

Demo 2: The script can access Internet to find answers to the questions.

10Jul

Raspberry Pi Audio Input and Output with USB Sound Card

Raspbian sound input and output.

1) Force the USB sound card to be the default sound device
Use nano to open file /etc/modprobe.d/alsa-base.conf

Change:

options snd-usb-audio index=-2

To:

options snd-usb-audio index=0

Then add:

options snd_bcm2835 index=1

2) To record sound

Use command:

arecord -f cd -d 10 -c 1 record.wav

This command records sound input from the microphone for 10 seconds and writes the audio to record.wav file.

3) To playback recorded audio

Use command:

aplay -f cd -D plughw:0,0 record.wav

16May

Installing VirtualBox Guest Additions on Ubuntu Guest

It seems on Ubuntu guest OS, there is some dependency issue when trying to install the VirtualBox Guest Additions by using the following packages:

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11

The following errors will occur when the above command is run.

The following packages have unmet dependencies: virtualbox-guest-x11: Depends: xorg-video-abi-15 Depends: xserver-xorg-core (>= 2:1.14.99.902)

The solution is to run the command below before you install the VirtualBox Guest Additions packages.

sudo apt-get install xserver-xorg-core

This works for me on XUbuntu 14.04. I am still trying to resolve the resolution problem on Windows 10 guest. It doesn’t seem the VirualBox Guest Additions have any affect on Windows 10 guest even it is installed without error.

30Apr

Myst of Adobe Analytics API Segment ID

A colleage is working on the Adobe Analytics (Omniture) API and try to use some segments, so I gave him this page https://marketing.adobe.com/developer/api-explorer#ReportSuite.GetSegments to find out the segment IDs he wants to use. Then we found there is very small discrapancy in the data responded by the API and the data from the web reporting interface.

First, we found that the segment ID we got is in a very different length of the segment ID I got months ago. For the same segment, the old segment ID is something like “dw:1234567” and the new one is something like “537d53drr4b0893ab30706ac”. Turns out, if you use version 1.3, the ReportSuite.GetSegments API function will return you something like the old format. And with version 1.4, it returns the new format.

And most strange thing is, if in the data API call, you put in “dw:537d53drr4b0893ab30706ac”, the API still responds with the data, no errors. But the data could have discrapancy compared to the actual reports. However, if you remove the “dw:” prefix, it will be OK. I don’t understand why Adobe would allow “dw:537d53drr4b0893ab30706ac” and even would return some data very close to the actual report but not the same as the actual report.

This is another thing I found about how terrible the Adobe APIs are.

13Jan

Reuse Google Analytics eCommerce Data for Marketing Tag via GTM

Tag-ManagerGoogle Tag Manager (GTM) makes tracking a lot easier for Google Analytics and its new version Universal Analytics. There is a new format of eCommerce tracking called enhanced eCommerce for Universal Analytics tags. To track the purchase, you would need to put some dataLayer code on the purchase confirmation page like the example below.


<script>
// Send transaction data with a pageview if available
// when the page loads. Otherwise, use an event when the transaction
// data becomes available.
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': 'T12345', // Transaction ID. Required for purchases and refunds.
'affiliation': 'Online Store',
'revenue': '35.43', // Total transaction value (incl. tax and shipping)
'tax':'4.90',
'shipping': '5.99',
'coupon': 'SUMMER_SALE'
},
'products': [{ // List of productFieldObjects.
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1,
'coupon': '' // Optional fields may be omitted or set to empty string.
},
{
'name': 'Donut Friday Scented T-Shirt',
'id': '67890',
'price': '33.75',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Black',
'quantity': 1
}] }
}
});
</script>

And after that, you just need to tick a checkbox in the Universal Analytics tag in GTM to enable eCommerce tracking. There are more details on this Google document to provide guidance on implementing the eCommerce tracking: https://developers.google.com/tag-manager/enhanced-ecommerce

With a tag management solution, you should be able to reuse the data you capture to fire other tracking tags without changing the code on the pages. So, this article is to give some instructions on how to reuse the eCommerce data captured for Universal Analytics in other tags, especially marketing conversion tags.

Now, if you read the code, you can see a lot information are captured about the transaction. For example, the transaction revenue is particular interesting one for measuring the ROI. Many ad server platforms support revenue variable in the conversion tags. When you generate the tag from the ad server platform, make sure you request it. For example, a DoubleClick image tag with conversion value looks like this (with $5 conversion value):

http://www.googleadservices.com/pagead/conversion/1234567890/?value=5.0&label=Purch
ase&script=0

The code is from this document: https://support.google.com/adxbuyer/answer/165288?hl=en

Let’s reuse the revenue we captured in the eCommerce code to populate the DoubleClick tag above. There are a few steps involved assuming you already have the eCommerce tracking working for Universal Analytics via GTM.

Step 1: Create a macro for the revenue

A macro is a variable in GTM which you can use in your tags. Login to GTM, and create a new macro called “Purchase Revenue”, select “Data Layer Variable” as the type, and put in “ecommerce.purchase.actionField.revenue” as the value. That means if there is eCommerce dataLayer on the page, macro “Purchase Revenue” will be the transaction revenue extracted from the dataLayer.

Step 2: Create your marketing tag

Now, the macro is ready for use on purchase confirmation. Let’s assume you want to create a DoubleClick sales conversion tag in GTM, after filling in the necessary information, on the revenue field, simply put in “{{Purchase Revenue}}” and that will populate the transaction revenue from the eCommerce tracking to the tag. You still need to setup the rules to fire the tag as usual.

The macro can also be used in Javascript so if you need it for other tags, you can do it in the same way.

That’s pretty much it. Test the tag and release it, you will have revenue in your conversion tracking in your marketing campaigns. If you have any question and comment, please submit it over the form below.

2Jan

Walked Across Sydney Harbour Bridge

24Nov

Who to trust, Web Analytics or Bitly?

In a Facebook campaign, Bitly says there are 776 clicks, and the web analytics tool says there are only 30+ visits and even less conversions. So the marketing team was thinking it must be something wrong with the tracking in the web analytics tool. But just need to have a look at the source of the clicks, yes, there are only 33 clicks from Facebook, where the link was posted. How about those 743 clicks without any referrer information? I think they are just robots crawling the web. Facebook is like a magnet attracting robots because of the fact that it constantly has new posts.

Capture

© Copyright 2014, All Rights Reserved