HI, thanks for the module,

I follow the Google AdWords Keyword Tool link, put in my keywords, click on the only download link i can find and theres about 5 differen download formats, ive tried all of them but when ver I try to import the file I get File does not match proper format..

Thanks for any advice on this,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pixelsweatshop’s picture

Same here. Need some more instructions. :)

TomDude48’s picture

The format to use is "CSV for Excel". I just tried it and didn't have a problem.

Try it again using CSV for Excel. If it still doesn't work, send me the exported file and I will see what is going on.

kndr’s picture

Component: Miscellaneous » Code
Category: support » bug
Status: Active » Needs review
FileSize
8.51 KB
1.49 KB

Bugs, I found:
1) There are hardcoded english words inside the code, which causes rejecting international files,
2) There are no translations for english words like "Keyword" etc.,
3) Byte order mark (BOM) http://en.wikipedia.org/wiki/Byte_order_mark should be deleted from the begining of file,
4) function iconv should be replaced by mb_convert_encoding().

After patching this, I can import Google file but there is some other bugs, which causes weird characters inside keywords. It breaks javascript. My conclusion: Keyword Research is the nice and smart module but not ready for languages other than english.

com_net’s picture

patch faild with:

patch -i patch
patching file kwresearch_google.module
patch: **** malformed patch at line 25:   -   $data = iconv("UCS-2","UTF-8", $data);

manual patching doesn't work - import still says "File does not match proper format." (language=russian)

kndr’s picture

You should translate english header titles ("Keyword", "Global Monthly Searches", "Local Monthly Searches", "Monthly searches") to russian language. Use /admin/build/translate to do this. Anyway, I don't use this module. In my opinion, it is too buggy for languages other than english.

Avasyu’s picture

Any progress on this? Here is my csv file I am working with.

TomDude48’s picture

I applied kndr's patch. Let me know if this work properly for non English.

Marko B’s picture

Kndr, well i would have to say Drupal in total is still too buggy for other languages for professional use. Sadly beacuse many people contributing are from non-english countries. I am working daily on international sites and cant begin to state how much problems are with meta tags, paths, views... to have them all properly working in multi lang eviroment :-( sometimes this just pisses me off too much as this shouldnt be the way and drupal should be founded on "equality" and its often felt that languages aren't so important to work properly and are last ones to be fixed.

easyRider’s picture

Same problem here, subscribing

jscm’s picture

this module have serious problems working with google adwords keyword tools data imported.

antoniotorres’s picture

Yup, using csv for excel and it says "File does not match proper format."

Attached is my file.

antoniotorres’s picture

Derp, I zipped instead of using txt, resubmitting.

roxtaz’s picture

Version: 6.x-1.0-rc4 » 7.x-1.0-alpha3
FileSize
2.44 KB

Subscribing ... After importing csv for Excel file in romanian:

File does not match proper format.

The csv file is attached.

Jawi’s picture

File does not match proper format.

same issue here!
Can't import csv for excel file of adwords export.

Jawi’s picture

Can u tell me what format we should use for importing csv?
Do you have an example file we can use?

Thanks

Jawi’s picture

File does not match proper format.......

anybody succesfully imported google data with csv file ???

PatchRanger’s picture

wolfdream’s picture

Succeeded by deleting columns in .cvs for Excel

This is what i get when download csv for Croatian search
Columns:
Ad Group Keyword Competition Global Monthly Searches Local Monthly Searches (Croatia) Approximate CPC (Search) - HRK Nov 2012 Oct 2012 Sep 2012 Aug 2012 Jul 2012 Jun 2012 May 2012 Apr 2012 Mar 2012 Feb 2012 Jan 2012 Dec 2011

Remove/delete every column and rename remains, so only columns exist on csv file

Keyword Competition Global Monthly Searches Local Monthly Searches

Jawi’s picture

Nice

thank u for sharing!

lsolesen’s picture

Status: Needs review » Needs work
FileSize
3.31 KB

Also having trouble with a Danish file even after renaming and checking up on the columns.

darol100’s picture

Version: 7.x-1.0-alpha3 » 7.x-1.0-alpha4
Issue summary: View changes

I still have the same issue 7.x-1.0-alpha4. Anyone knows how to fix this issue ?

I created a post in the forum and nobody reply to me. https://drupal.org/node/2244663

prestondocks’s picture

I have got this to work but only after fixing all the errors in the code and there are lot of them. There is no way that this passed any tests before it was released.

If you are looking to fix this yourself, then when looking through the module code you find errors in the following areas

$data = iconv("UCS-2","UTF-8", $data); -- there is more than one of these statements and they all need removing.

These are the columns that you need
Keyword
Monthly searches
Competition
Avg CPC

You will have to alter the downloaded CSV file and move columns around to match the order I have given above. Also Ensure that the names are the same (Note the small s in searches)

there is a line in one of the DB update functions

WHERE keyphrase = "%s"

This needs changing to

WHERE keyphrase = :keyphrase

Other issues that are not the fault of the author is that it seems google have changed the csv column headings. However the Author should have noted this and either removed the module or fixed to support the headings.

This is the file you need to edit
sites / all / modules / kwresearch / modules / kwresearch_google / kwresearch_google.module

I made these changes to suit my purposes, and I may have missed other changes that I made as I was going through it. You may not get the same millage, but it's worth a try.

darol100’s picture

@prestondocks

Can you create a patch with your changes ?

bradyemerson’s picture

My patch in order to get keyword import working again. Now only accepts adwords file in latest format.

I'm looking for the following columns:
0 - ignored
1 - Keyword
2 - ignored
3 - Avg. Monthly Searches (exact match only)
4 - Competition
5 - Suggested bid

I'm using suggested bid column for AVG CPC as that doesn't appear to be present in the file anymore. It sort of make sense to me that these numbers would be close, but is this completely wrong? I only have a high level exposure to online marketing.

I also converted the insert/update statement to use db_merge and cleaned up some whitespace/formatting issues I saw.

darol100’s picture

@bradyemerson, I think your patch have a error or something because I try it out in local environment and I didn't have any effect. In other words the module still showing me the error "File does not match proper format". Also, I try it to run it using Simplytest.me and I got an error while applying the patch.

I notice in your patch that you have a directory call kwresearch_google and i do not you have that on my kwresearch module. Did you try to create a new version of the module or something ?

I have the latest version of the module "7.x-1.0-alpha4"

bradyemerson’s picture

@darol100, within the modules folder, you should see kwresearch_google. This patch was done off of the alpha4 version.

You may need to resave the csv file from Google. I opened mine and excel thought it was a txt file. I "saved as" with the csv filetype option selected (if on a Mac, choose CSV for windows) and it worked for me.

scuis’s picture

I don't know how to make a patch but I modified kwresearch_google.module and now it's working fine. I'm sure someone can improve this. I have 7.x-1.0-alpha4 version. I hope it helps.

It only works if, in your AdWords account, your language and number format are set to "United States". If not, csv's numbers are exported as text (quoted with comma as a decimal separator) and importing fails.

I've made some changes from line 112 to 202:

/**
* Processes Google keywords import form
*
* @param $form
* @param $form_state
*/
function kwresearch_google_keywords_import_form_submit($form, &$form_state) {
//dsm($form);
//dsm($form_state);
$row = 1;
$keywords = '';
$imported = 0;
if (($handle = fopen($form_state['values']['file']->uri, "r")) !== FALSE) {
// remove header line
$data = fgets($handle);
// older verion trying the newer mb_convert_endoing method

//$data = iconv("UCS-2","UTF-8", $data);

//$data = ltrim($data, "\xFF\xFE");
$data = mb_convert_encoding($data, "UTF-8", "UCS-2");

$a = explode("\t", $data);
foreach ($a as $i => $v) {
$a[$i] = trim($a[$i]);
}

if ( ($a[1] == 'Keyword') && ($a[3] == 'Avg. Monthly Searches (exact match only)') && ($a[4] == 'Competition')) {
$format = 'adwords';
$col_count = count($a);
$bid_enabled = FALSE;
if (isset($a[4]) && (strpos($a[5], 'Suggested bid')) === 0) {
$bid_enabled = TRUE;
}
}
elseif (($a[0] == t('Keyword')) && ($a[1] == t('Monthly searches'))) {
$format = 'sktool';
}
else {
drupal_set_message(t('File does not match proper format.'), 'error');
return FALSE;
}
while (($data = fgets($handle)) !== FALSE) {
//$data = iconv("UCS-2","UTF-8", $data);

$data = mb_convert_encoding($data, "UTF-8", "UCS-2");
//$data = trim($data);
//echo "$data
\n"; continue;

if ($format == 'adwords') {

$keyword = '';
$competition = 0;
$global_monthly = 0;
$local_monthly = 0;
$avg_cpc = NULL;
$cols = explode("\t", $data);
if (count($cols) != $col_count) {
continue;
}
// skip entry if invalid data
if (!is_numeric($cols[3]) || !is_numeric($cols[4]) ) {
continue;
}
$keyword = $cols[1];
$competition = $cols[4];
$global_monthly = $cols[3];
$local_monthly = $cols[3];
if ($bid_enabled) {
$avg_cpc = $cols[5];
}
$monthly_searches = $local_monthly;
}
elseif ($format == 'sktool') {
list($keyword, $local_monthly, $competition, $avg_cpc) = explode("\t", $data);
$monthly_searches = $local_monthly;
$competition /= 10;
}
if (!$keyword) {
continue;
}
$competition *= 100;
if(isset($avg_cpc) && $avg_cpc) {
$avg_cpc = (float) substr($avg_cpc, 1);
}
else {
$avg_cpc = 0.0;
}
$keyword = trim(strtolower($keyword));

vipul tulse’s picture

Greetings

Hi alll

Use the dev version of keyword research module its working for me.

If din't work please leave your email I'll mail you my module.