Web Development

Adwords Ad Disapproved for Seemingly Fine Ad (Clarity and relevance)

So, I was working with Adwords recently and I made a custom set of image ads. It was a set of image ads that were actually previously approved by Google, however, this time when I uploaded them they were not. I was about to just find out that Google Adwords moderators had got a lot stricter on what information needs to be displayed in new ads.

This is not something you will hear from your account manager. Mine couldn’t understand why the ad was disapproved either.

I found this out through trial and error.

As stated by Google https://support.google.com/adwordspolicy/answer/6021546?hl=en-GB#326 in their rules for display:

Make sure that you include your product name, company name, logo or Display URL in your promotion. For animated ads, please ensure that once the animation has ceased, the final static frame clearly displays identifying information such as a product or company name, logo or Display URL.

However, if you have seen Google Ads before you will notice they are not very good at implementing this rule. You can have an ad running that does not show a product name or company name and many don’t.

However, it is hard to understand that this is the problem. The only message you will get in your email is:

Ad Text:


Ad Status: Disapproved
Ad Issue(s): Clarity and relevance

—> To keep our ads professional and effective, we don’t allow ads that are unclear, confusing, low quality or that make unsupported claims. Ads also need to lead users to relevant content and accurately reflect the business, product or service that’s promoted on your site. Edit your ad to make it easy to read and specifically related to what’s promoted on your landing page.

But this is deceptive in itself. Once I added my company name to all my ads they were approved.

PHP, Web Development, Yii Framework

Stop Newrelic From Recording Slow AJAX/General Calls in Yii2


namespace common\components;

use Yii;
use yii\base\Component;
use yii\base\BootstrapInterface;
use yii\web\Application;
use yii\web\Controller;

class Newrelic extends Component implements BootstrapInterface
    public $ignoreRoutes = [];

    public function bootstrap($app)
        // delay attaching event handler to the view component after it is fully configured
        $app->on(Controller::EVENT_BEFORE_ACTION, function () use ($app) {

    public function beforeAction($app)
        if (extension_loaded('newrelic')) {
            if (in_array(Yii::$app->getUrlManager()->parseRequest($app->request)[0], $this->ignoreRoutes)) {
SEO, Web Development

Should search pages be blocked in robots?

I recently got a problem on a site I co-manage whereby Goolge Webmaster Tools suddenly stated one day, after some extensive crawling, that the site had far too many URLs.

In the list I saw many search result pages and after some investigation various links directed me to this page whereby, at the bottom, it says:

Typically, you should consider blocking dynamic URLs, such as URLs that generate search results,

So, it seems that this, normally, grey area is quite black and white now-a-days and you should be blocking your search from robots, else Google could penalise you by not correctly crawling your site.

CSS, Web Development

Responsive images via background-size

As I was doing some image uploading work on a project recently I decided to understand, truly, if, for image post-processing, I should resize and cut corners off to keep ratio or thumbnail and keep the independent size of the image, but risk making it difficult to put into the page.

As an example, I have an image of 700px x 418px. I have a choice between cutting it down to 400px x 400px, cutting off 300px or bringing it down to about 400px x 238px and make it more difficult to add to a Bootstrap powered gallery.

So, I looked at what Facebook did here and I noticed they actually use the 400×238 image as a background image and then used background-size:cover to fix any problems. Fortunately, despite what caniuse.com (http://caniuse.com/#feat=background-img-opts) says, background-size is supported in IE8 (I actually got a Windows 7 VM with IE8 on it from modern.ie and tested it) but, with no content, the media queries for resizing the columns could not function right.

So I need something to tell both IE8 and later browsers how to size this image.

The CSS solution at this link works perfect: http://www.smashingmagazine.com/2013/07/22/simple-responsive-images-with-css-background-images

In short, here is the post summarised:

<div style="width: 400px">
    <span id="image">
        <span id="image-inner">

#image {
    display: inline-block;
    width: 100%;
    font-size: 0;
    line-height: 0;
    vertical-align: middle;
    background-size: 100%;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-image: url(image.jpg); 

#image-inner {
    display: block;
    height: 0;
    padding-top: 63.3%;
PHP, Yii Framework

Getting Yii2 Debug to Show on User Role Instead of IP


namespace common\components;

use Yii;
use yii\debug\Module as DebugModule;
use common\models\User;

class Module extends DebugModule
    private $_basePath;

    protected function checkAccess()
        $user = Yii::$app->getUser();

        if (
            $user->identity &&
        ) {
            return true;
        return parent::checkAccess();

     * Returns the root directory of the module.
     * It defaults to the directory containing the module class file.
     * @return string the root directory of the module.
    public function getBasePath()
        if ($this->_basePath === null) {
            $class = new \ReflectionClass(new yii\debug\Module('debug'));
            $this->_basePath = dirname($class->getFileName());

        return $this->_basePath;