Archive for May, 2016

It occurred to me that there may be other people out there interested in detecting the presence of adblockers on their website. Here’s my approach.

First a little primer. When you sign up for adsense, adsense has you add a small code block to your website. The code block contains an ins element with class name “adsbygoogle”. When the adsense javascript code runs, it finds this element in your DOM and inserts the ad into it.

Most ad blockers work by preventing the adsense javascript file from downloading to the user’s browser and executing. Therefore, the simplest and most straight forward way to detect an adblocker is to see if any content was inserted into the ins “adsbygoogle” element. If you’re using javascript with the jquery library that might look like:

$(window).load(function() {
setTimeout(function() {
var ad = $(“ins.adsbygoogle”);
if (ad.length > 0 && ad.html().replace(/\s/g, “”).length == 0) {
console.log(“Ad blocked”);
}, 2000);});

The code sets a 2 second (2000 milisecond) timeout to give the adsense script time to load an execute. After two seconds have elapsed, it uses the jquery selector to find the ins element with adsbygoogle class. If the ins element is present, it checks to see if the tag contents (with the .html() call) has zero length and thus was not populated.

There are a couple drawbacks to this approach. While most adblockers work by preventing the ins element from being populated, some adblockers remove the ins element from the document DOM altogether. Others modify the css properties so the ins element is no longer visible. In my case some pages, such as the terms of service, are ad-less by design. I wanted to detect a modified DOM which meant signaling to my detection script whether an ins element was expected to be present in the first place.

The first thing I did was create a div container around my google adsense ins tag. Most adblockers give you the ability to hide arbitrary elements on a page, so you can hide any ad the blocker may have missed. Blockers store information about the element (usually the id) so they can continue to block the element if you leave the page and come back, or they see the element on other pages in the same domain. By creating a random string each element appears different to the adblocker. There is no way for the adblocker to hide all my container divs (see note below for caveat.)

This is done by PHP and might look like:

$id = getRandomID();
echo “<div id=\”$id\”><ins class=”adsbygoogle”…
echo “<script>addAdsenseID(‘$id’);</script>”;

The function getRandomID() is a user created function I didn’t include for brevity. Insert your favorite random string generator. The last step, addAdsenseID is a javascript call that ads the id to an array.

The updated javascript now looks like:

$(window).load(function() {
setTimeout(function() {
for (var id in adsenseIds){
var ad = $(‘#’ + id + ‘ ins.adsbygoogle’);
if (ad.length > 0){
console.log(“DOM modified”);
} else {
if (ad.html().replace(/\s/g, “”).length == 0){
console.log(“Ad Content Empty”);
} else if (ad.css(‘display’) == ‘none’){
console.log(“Ad Display None”);

}, 2000);});

No more over counting pages without ads, no more missing the case where the DOM has been modified. It happens rarely, but as a data scientist “rarely” is just not specific enough. I opted to inspect each adsense element, but if you wanted one check per page you could always replace the for loop declaration with something like “var id = adsenseIds[0];”

Caveats: While my approach is robust enough for my purposes, it’s not full proof. At present I see two possible work arounds.

1.) A user can disable javascript altogether. With javascript disabled, my detection script won’t run. I doubt anyone would do that on my website since that would also render all the apps useless. I’m not loosing any sleep over this one.

2.) The ids I generated for my container div elements were completely random, but the ids for the elements on the rest of the page or not. Certain characters (‘q’, ‘x’, ‘z’, etc) are more likely to occur in random strings than strings based on English. One could create a statistical modal to predict whether an id was a random string and thus the container div id. It’s a lot of work, but it’s possible.

Nicole, stopping to smell the flowers
The 150,821th (literally, I checked) photo captured with my second DSLR. I can’t help but think all this practice has really been paying off!

My new go-to trick with child photography is to turn photo time into game time, and no game is too silly.

We’re well into the period I dub ‘Cheese Face.’ When Nicole sees a camera, she clenches her jaw, pulls back her lips, squints her eyes and gives her best “Cheese.” The end result is kind of like Sheldon Cooper’s Happy-for-Koothrappali/Kill-The-Batman face, just without the big eyes. Cheese face phase a common phase most kids go through when they realize what the camera is for. She’s smiling how she thinks the photographer want her to smile. To get ride of cheese face I need to get her out of her own head and not thinking about smiling.

The best way to get ride of the cheese face, to elicit genuine smiles and giggles, and to turn photo time into game time. I’ll ask Nicole not to smile. I’ll tell her to make a silly/angry/sad face, but no matter what Do. Not. Smile. Small children are just not capable of holding in a smile. She can’t help but burst out into giggles fit while trying to make her not-smile face. That’s the moment I get snap happy!

Another trick is to be decidedly silly. Will sing the ABCs, and instead of L M N and O, I’ll sing El-eme-eme-o (Elmo), or E-I-E-I-Owie. (That latter one was an idea stollen from Alexis who used to always sing Old McDonald that way.)

I’ve been employing a similar trick for poses. Whenever I try and pose her the photo always looks forced. She’s trying to sit still and thinking about how she’s supposed to be posed. She’s not having fun, and it shows. Rather than try and pose her directly, I find a game that will elicit the pose I’m after. Catch Me!, Run Me Over With Your Bike!, I’ll bet you can’t touch that flower with your nose! The trick is finding the right moments in the game to get the perfect expression, and to be in the right spot when it happens. It doesn’t always work, but when it does, it’s magic. The funner the game, the more chances I’ll have to capture gold.

One of the things that I think is holding my business back is the lack of a good name/corporate identity. I track my incoming links pretty closely, and I’ve noticed a tendency for users to be more trusting for websites that look corporate rather than personal. That’s bad news for me as my business name is my name.

Frustration is finding a perfect name, and discovering it had been registered just days before you came with it.

When my search was coming up incredibly short, I started thinking about branching out from the standard dotcom/commercial names. The past couple of years has seen an Explosion in new top level domain names. These are corporate sponsored (application prices started at $185,000). The expansion of new domain names was build as good to companies as they could have greater control over their brand, and good for consumers since there would be more choices. I’ve always been a little skeptical of additional top level domain (gTLD) names – (how often can two corporate identities succeed while have the same name?) – but I now have a new reason to be skeptical. There may be more domain names technically available, but that doesn’t mean there are more functionally available.

As I was thinking about the domain names, I came across the .space extension. How cool would be? And it wasn’t already registered! To my dismay I realized that even though it was unclaimed, it would cost me at least $5,000-$6,5000 A Year.

To back track a little, the price for a new dotcom domain (if you can find one) is relatively low at around $10. That’s because there are thousands of registrars who can offer dotcom names and competition is a consumer’s best friend. Competition puts pressure on registrars to keep their prices low. Some registrars will register what they consider premium domains so they can resell them for a higher fee, but there’s nothing from keeping a customer from transferring between registers once they acquire the domain to keep the future years’ pricing down.

Registrars who wish to sell dotspace domains need to be accredited through Radix. Radix, a for profit entity, can set the price as they see fit, and has decided to set the price relative to what they think a domain is worth. would also be 5k/year. would be $1k/year. The much less cool would only be $10 a year. As the company who applied for the dotspace gTLD from ICANN, Radix has full control.

This discovery has me a little nervous about trusting new (gTLD). While the expectation is for the price of these domains to come down, there’s no guarantee. There’s no guarantee the price wouldn’t rise in the future. It’s a risk I’m not willing to take when it’s already so difficult to build a brand.

It’s back to the drawing board for me. I’m currently considering a phonetic spelling of a dotcom name I like, but is registered and unused. At least there will be some cost certainty.

I recently came across this new camera roll app for IOS that not only clusters photos based on subject matter, but computes an “ascetic score” and can show you your most ascetically pleasing photos. As someone who has 4,939 photos on her phone, and a love of machine learning, I had to give it a try.

My most aesthetically pleasing photo this month is… drumroll

A nail sticking out of the floor which I have caught my foot on way too many times. I took this photo so I could show the kind folks at home depot what I was talking about. It just will not stay down no matter how many times I hammer it!

I disagree. I mean it’s a fine nail and all, but my most aesthetically pleasing photo? Adding insult to injury, the nail in the floor board photo only received an ascetic score of 71%.

The clustering results were mixed. Most of the time I’d get a several clusters of what I’d consider to be the same subject matter. Admittedly, it’s more handy to scroll through effectively ten photos rather than hundreds. In scrolling through the curated roll I found cute photos I had forgotten I had taken. But the other kind of fail, when photos are clustered that shouldn’t be, is much less forgivable. When the app fails, it fails big time.

Take the following example:



In the above photos, photo A was in a cluster with similar photos, while B, C, and D were clustered together. B & C I can understand; their different children but the same general framing, although A & C are closer in framing. I would prefer A & B to be a cluster, but wouldn’t mind A, B & C. And D? What the heck happened there? Also the respective image ascetic scores are 38%, 38%, 36% and 24%. While I wouldn’t use them to showcase my work, I do think they beat nail-in-floor-board. Except maybe photo D. I have no idea what I was going for there.

Me being me, I set out to reverse engineer the algorithm and see if I could figure out what is happening.

It appears that photos are being clustered based primarily on the timestamp. Cluster B, C and D’s photos were taken from 9:16 – 9:17, where as Cluster A’s photos were taken at 9:18. It appears that a photo is added to the current cluster if it’s tags are similar to the photos in that cluster, otherwise a new cluster is formed. There’s no interleaving. As a result, visually similar photos are sometimes buried distributed in different clusters. “Buried” might be a better term, if visually different photos have a higher ascetic score and are used as the key example from the cluster. For example, the top photo in B, C and D’s cluster is another photo of Alexis. This an undesirable feature is made extra bad by the fact that the app offers to delete “visually similar” (i.e. the less ascetically pleasing photos in the cluster.) That would mean all photos of Nicole by the flowers.

I can’t help but wonder how I would have clustered the photos. My first instinct was also to use the timestamp, however, I would allow for clusters to interleave. When taking photos I don’t decide to take photos of one child in the swing, switch to the other child on the slide, and then call it done. I usually go back and forth between the girls with my attention. Clearly Photos B & A should be in the same cluster, even though D was taken after B but before A.

My next instinct was to cluster photos based on color similarity. Putting the above four photos through my Image Color Pallet app I get the following pallets:


Photos A & B have identical color pallets. Photo C is very similar, but has a blue cluster in place of the pink cluster, as the two girls are wearing different color jackets. Photo D, on the other hand, is very different. Clustering based on color pallets would put A & B in the same cluster, and possibly add photo C depending on the sensitivity threshold.

While aesthetics can be a bit subjective, I was delighted to find a few research papers on the topic of creating an algorithmic base approach to predicting how aesthetically pleasing an image is. This knowledge will come in handy for the photograph apps I’m working on!

May 7, 2016

Hallmark 2016 Plan

Where did the time go? It’s already May! Time to think about Christmas ornaments.

All kidding aside, I think I forgot about Hallmark this year partially because I haven’t been enjoying collecting the keepsakes as much the past couple of years. I didn’t set foot in a hallmark store last year. Penguin Tales was the only ornament I wanted at the premiere, and I could purchase it off Amazon for the same price. I did get Cozy on Ice and Can’t Wait to Skate on eBay in an after Christmas sale. I spent too much time on eBay and purchased Making Mom & Daughter Memories which I don’t remember seeing in last year’s dreambook.

My current 2016 plan:

A Tasty Treat – That’s a big old yes. I was so disappointing Hallmark stopped the unofficial gumdrop series last year. They may have been mini ornaments, but they were my favorite. (Miniature prices didn’t hurt either!) This new series could fill the void. It has that same cuteness + sweetness combination. I’m a sucker for designs based on sugar.

That’s a Wrap – It’s cute, but I’m on the fence. My gut reaction was to want it, but I’m worried I’m letting the fact that I already own many of the other pieces in the series influence my decision. I don’t think I would purchase it if it was a stand alone ornament. My concern is that it looks less detailed than most of the other ornaments. Usually when the photo looks less detailed the ornament disappoints in person. I’ll have to wait to make the final decision.

Cookie Cutter Christmas – I’m going to pass on this one. I’m not a fan of the mitten shape. I think I’ll even pass if I see it in an after Christmas sale.

Playground Pals – I normally collect the penguins, and it’s a cute concept, but I think I will pass. If I didn’t know that was supposed to be a marry-go-round from the description I’m not sure I would have guessed it.

Comfy and Cozy – It’s adorable, but what’s with Mary Hamilton’s Bears series price tag? I bulked at the nearly $20 price tag last year, then snagged it for $5 shipped on Ebay back in February. I’ll wait for this one as well. I hope I can get it cheaply too. Then again, finding ornaments from a series cheaply on eBay is not a good sign for the series’ longevity.

That’s 1 yes, 2 no‘s, 1 most likely pass and 1 only if I can get it in an after Christmas sale. Not a lot of reason to go to the store, is there?

There’s another ornament I want! I somehow missed the 2016 Baking Mom & Daughter Memories, which I like way more than the 2015 Making Mom & Daughter Memories. The 2016 Season’s Treatings is finally a Cinnamon Rolls theme. Cinnamon Rolls have special significance to me, but I’m on the fence about the design.

The number one factor in child photography is the photographer, but not for the reason you think. It’s all about the connection between the person behind the camera and the person in front of it.


Nicole has been looking forward to having her picture taken as a fairy princess for weeks. I set up the appointment about a month ago when I saw the sign at JCPenney’s. Nicole loves dress up and loves photo time, and she really loves the confluence of the two. I knew she’d be over the moon excited for dress up photo time.

The day of, however, it was shaping up to be an unmitigated disaster. Alexis was awoken up an hour prematurity from her nap by our neighbor’s lawn mower. Nicole was over excited, and acting out as three year olds tend to do when their over excited. Alexis was coping her older sibling, as younger siblings tend to do. It was an explosive combination, one that went off several times between the end of Alexis’ nap and our appointment, including just minutes before the photographer was ready for us because Mommy dared to take off her shoes.

Our photographer was a dream. She’s the one who had taken Nicole’s photos before we moved to Silicon Valley and was the person I requested when we moved back. She had never met Alexis before, and yet was able to create a connection with her. Alexis forgot all about her shoes, and the lack there of.

A technically wonderful photo of an unhappy child is still a photo of an unhappy child.

After we were done, the photographer put a movie on for Nicole while she and I looked over the proofs with Alexis in my lap. The photographer would occasionally lean over and tickle her tummy. Alexis was so in to having the photographer tickle her tummy, that she kept making the “more” sign while insisting “Mawr!” I tried to tickle her tummy so the photographer was free to work on the proofs, but Mommy was an unacceptable tummy tickler substitute.

It’s rare for Alexis to connect with any of the other photographers we’ve tried. She’s always been a little more weary of strangers than Nicole, and hasn’t had the love for being in front of the camera like Nicole. Finding a photographer who can connect with one’s kids is an awesome feeling. We’ve already booked an appointment for family photos. I need a new photo for above our mantle.

I did it! I reached my first target, a dollar a day! Last month I earned $31.60, or $1.05 a day!

As happy as I am by that, I’m not so sure I can take credit for it. Compared to the previous period, I had slightly fewer users and roughly the same number of ad impressions. I can’t credit my apps with putting more eyeballs to ads. The only change that I made that might have influenced my ad revenue was updating the descriptions. It’s possible better descriptions have led to more interested users, and more interested users might be more engaged and more likely to click. Or maybe better descriptions lead to better understanding of the page and better ads. Or maybe I’m over reaching and it’s random good luck. Either way, I’ll take it!

This month I added three new apps:

Prime, Not Prime – Think of it as hot or not, but with primes. It’s a bit harder than I intended to make it. I rarely get more than 10 before I lose the game. Maybe I’m not as good with math as I thought.

Pregnancy – Week by Week – Most pregnancy calendars have a lot of filler like how big baby is, and how he/she is developing. Many of them have a separate page for each week. (More pages means more ads shown and more revenue.) While I can appreciate the usefulness of all the extra information, sometimes you just want a calendar you can quickly scan. This app is modeled after my favorite pregnancy calendar app which was sadly taken down.

Daily Miscarriage Probability Chart – I love the Miscarriage Odds Reassurer, but it’s just not doing well. I think part of the problem is in the way people search. I’m sure the query “weekly probability of miscarriage” is much more common than “reassure me about miscarriage”. The Daily chart is designed to meet the query & intent I think most people have. There’s a link to the the reassurer from the chart. It’s my hope that anyone who needs a little extra reassurance will find their way to the reassurer.

For the month of May I intend to focus on increasing my visibility. I’ve had a marked decrease in visitors to my Readability Analyzer in the past six months. Around that same time of the decrease, I move the ads above the fold by moving text below it. Maybe the change in text hurt my search rankings, resulting in the decrease in visibility. It’s worth looking in to.