Formatting results from Google Search Console API

Issue: using python, google search console API csv lines starts all with the following string



The \xef\xbb\xbf is the BOM. It came here because I was actually encoding the result in utf-8-sig instead of utf-8. Just make sure to properly encode the returned strings in utf-8 and this won’t bother you.

So after this correction we are left with the following:


This indicates that the date (which is the key) is actually of type bytes and not of type string.

To solve this just make sure to decode the bytes to string with the following code:


Sources of keywords

Google Search Console

It gives you queries for which Google Search returned your site as a result

Google Ad Keyword ideas

Primarily meant to find ideas for your Google Ad campaigns, it is a good source of keyword ideas for your SEO. In addition you can evaluate the value of the keyword thanks to volume forecast, recommended minimum biding and competition evaluation.

Latent Semantic Analysis

If the two sources of keyword above are based on user query (the most important) we can also extract valuable keywords from the site already online. Latent semantic analysis allow to find the most statistically significant keyword in a group of pages compared to a larger set of document which is suppose to be representative of the frequence of the words in the language.

Quality of the results yielded by this method depends greatly on the dataset and on the quality of the content for the specific topic you want to analyse. Topic with poor description and little written content (and no SEO effort ) are likely to yield poor results.

Evaluating the quality of the result of the LSA and optimizing the process to extract the maximum information will require some adjustement: is lemmatization a good idea for n-grams? Doesn’t it make results more difficult to analyze? Lemmatization was suppose to strengthen the presence of a given word by aggregating all its different forms in its unic lemma.

A possibility to evaluate the quality of the subset for the topic is to check how much words from the two first lists (after lemmmatization if necessary) are present in the documents. If little are found, it tends to indicate that this field is not optimized toward user query and possibly that little attention is given to the content, or that the content and the user queries for this topic are “disconnected” and that we have a good opportunity to fill the gap.

Override locotranslate translation strings

If you want to override some loco translate strings, you might have noticed a warning stating that changes to the file might be lost after wordpress/plugin/template update.

Let’s see how to avoid losing all your customization during the next update.

In Loco Translate select the plugins/theme/etc that you want to customize.

Hover over the the language you want to make changes to and click on copy.

Loco Translate let you create a copy of a translation file.

Note that system, on the right end of the picture above indicates that this is a system file and prone to be overwritten during the next update.

Once you have clicked on copy you are brought to a screen to set a new language. Well, good news, it doesn’t have to be a new language at all and you can create a copy of a file for an existing language. Let’s have a look at the settings.

Loco translate “New language” screen.

1- Choose the target language, in our case this is the one of the file we copied.

2- For the location, the most sensible is the custom location. System and Author might be subject to changes from update.

3- For the templates option use the “Just copy English source strings” option and changes just what you need, the rest will fallback safely on the string in the original file. If you have already make your change directly in the original then you can choose the first option.

Once you are all set, click on start translating.

If you need to edit your custom copy. Click on “Languages” in the Loco Translate menu. Choose the languagefor which you have created the copy you want to modify. You will see all templates available under WordPress Core , Plugins and Themes for this language. Look for the name of the plugin or theme you have modified. The original file will be listed as system and your copy will be listed as custom. Click on edit.

Tools for Malware Analysis

As there are a running campaign to send malware by mail disguised as invoice or price enquiry, I’d like to have some clue on what those malwares are suppose to do.

I will update the article with what I learn about the process of analysing reverse engineering malware.

The first step is to list the tools, and secure malware handling practice.

Regarding malware handling, I recall you shall handle them in virtual environment but I’d like to read more about it before I attempt anything on that line.

Step 1 – the tools

Virtual machine:

Oracle VM VirtualBox



This is an OS distribution to analyze both windows and Linux malware. The distro is based on Ubuntu.

Online courses: ($7000,00)

Tools for linux malware only:

Automating Linux Malware analysis using Limon sandbox:

SEO for images

The image should be relevant to your article. The name of the file should be relevant to the content of the image and be of the form: main-keyword-secondary-keyword.jpg

The image should be served at the size it will be displayed

Use srcset for responsiveness

Serve compressed image if possible in webp.

The number one SEO factor for images is the file name. It should have a structure such as keyword-secondaryword-index.jpg

The image URL is also important in giving context for the image to the search engine.

Create good URL structure for your images: Google uses the URL path as well as the file name to help it understand your images. Consider organizing your image content so that URLs are constructed logically.

Google Images Bet Practice

Use structured data for your content and include the image :

<script type="application/ld+json">
  "@context": "",
  "@type": "Product",
  "name": "Reguleeritav kontorilaud",
    "image": "",
      "description": "A compelling descritpion",
    "@type": "Offer",
    "priceCurrency": "EUR",
    "price": "575"

Alt description and title should contain your keyword but it doesn’t seem to be a major ranking factor.

Title and meta tags for the image are used by google to generate title and snippet for the image this might impact the click through rate. Most of the job regarding CTR must be done by the picture itself but I sometime use snippet to verify that the picture I am interested in is actually the right thing in the right context (imagine checking picture of clelbrities, you might sometime stop and check if that picture is actually from the celebrity, or if that product picture actually match the exact model you were interested in.

Google Images automatically generates a title and snippet to best explain each result and how it relates to the user query. This helps users decide whether or not to click on a result.

We use a number of different sources for this information, including descriptive information in the title, and meta tags for each page. 

Google Images Best Practice

About image quality:

Don’t use images that are too small or have a low resolution on the mobile version. Small or low-quality images might not be selected for inclusion in Google Images, or shown as favorably when indexed.

Numbers loaded as text when opening csv in openoffice calc

Issue: the numbers are loaded as text, when a cell containing such a number is selected, it shows that the number is preceded by a single quote and a space. search for the quote and replace it by nothing does not work.

Solution: When opening the file in open office make sure that detect special number is enabled

If your decimal sperator is a dot, then the number might be changed into a date, turn it off and replace the dot by a coma when the csv is open.

Also the csv file was created with python using utf8-sig which had a BOM each time it happened something to the file. Encoding the file using utf-8 only solved the issue.

Issue remains when you have both number separated by a dot that can be change into a date and integer.

Keyword research

The number one place for your keyword research is Google Ads Keyword planner.

This tool will give you suggestions, amount of search for each suggestion during a given time frame as well as competition on the keyword regarding advertisement. A lot of useful information.

If your site is up and running, you will find another useful source of keyword to explore in google webmaster tools.

Other sources of keyword are ahref and semrush

Add the url parameters for Laravel search results pagination

Issue: If you paginate your search result, when clicking on the 2 page, or any other nth page of your pagination link, it will return an url with the page parameter but without your search parameter. This cause your filtering to be lost.


Make sure to return your parameter variable from the controller function as you will need to call it on your blade view.

return view('my_view',compact( 'queryResult','my_variable'));

In your view:

@foreach($queryResult   as $stuff)
{{$ queryResult ->appends(['search_variable=>$my_variable])->links('vendor.pagination.materializecss')}}

if you have several URL parameters you can align the ->appends() one after the other. Don’t forget to ad the varaible to the view in the controller.

Passing variables to Laravel parameter grouping function

Issue: A statement such as

$nb_votes = $request->input('nb_votes');
            ->where('name', '=', 'John')
            ->where(function ($query) {
                $query->where('votes', '>', $nb_votes)
                      ->orWhere('title', '=', 'Admin');

will return an error:

Unknown variable $nb_votes 

The issue is due to the fact that $nb_votes in the anonymous function refers to the local scope, while the variable we want to use has been defined outisde of the function. We need to pass the variable to the anonymous function.

Solution: To pass a variable to an anonymous function you can do as follow:

$nb_votes = $request->input('nb_votes');
            ->where('name', '=', 'John')
            ->where(function ($query) use ( $nb_votes ) {
                $query->where('votes', '>', $nb_votes)
                      ->orWhere('title', '=', 'Admin');

see last example in example #3

For laravel queries documentation:

Check if a function is declared before using it in js

Issue: it may occurs that you have to call a function that is conditionally set. A frequent use case would be GDPR where you set your tracking script conditionally. You micht check the cookie for each event you track, but I think a better solution would be to track if he function is declared.


There are two different options:

Option 1:

This option will still return an error in case the function to evaluate is not defined.

function isFunction(TrackingScript) {
   TrackingScript ('button-click','cart',10);

Option 2:

if (typeof( TrackingScript ) === typeof(Function)){
       TrackingScript ('button-click','cart',10);