Needs work
Project:
Keyword Research
Version:
7.x-1.0-alpha4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Nov 2010 at 15:17 UTC
Updated:
16 Feb 2016 at 10:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pixelsweatshop commentedSame here. Need some more instructions. :)
Comment #2
TomDude48 commentedThe 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.
Comment #3
kndrBugs, 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.
Comment #4
com_net commentedpatch faild with:
manual patching doesn't work - import still says "File does not match proper format." (language=russian)
Comment #5
kndrYou 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.
Comment #6
Avasyu commentedAny progress on this? Here is my csv file I am working with.
Comment #7
TomDude48 commentedI applied kndr's patch. Let me know if this work properly for non English.
Comment #8
Marko B commentedKndr, 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.
Comment #9
easyRider commentedSame problem here, subscribing
Comment #10
jscm commentedthis module have serious problems working with google adwords keyword tools data imported.
Comment #11
antoniotorres commentedYup, using csv for excel and it says "File does not match proper format."
Attached is my file.
Comment #12
antoniotorres commentedDerp, I zipped instead of using txt, resubmitting.
Comment #13
roxtaz commentedSubscribing ... After importing csv for Excel file in romanian:
The csv file is attached.
Comment #14
jawi commentedFile does not match proper format.
same issue here!
Can't import csv for excel file of adwords export.
Comment #15
jawi commentedCan u tell me what format we should use for importing csv?
Do you have an example file we can use?
Thanks
Comment #16
jawi commentedFile does not match proper format.......
anybody succesfully imported google data with csv file ???
Comment #17
PatchRanger commentedMarked #1493124: import from google does not work for 6.x version as duplicate of this one.
Comment #18
wolfdream commentedSucceeded 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
Comment #19
jawi commentedNice
thank u for sharing!
Comment #20
lsolesen commentedAlso having trouble with a Danish file even after renaming and checking up on the columns.
Comment #21
darol100 commentedI 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
Comment #22
prestondocks commentedI 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.
Comment #23
darol100 commented@prestondocks
Can you create a patch with your changes ?
Comment #24
bradyemerson commentedMy 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.
Comment #25
darol100 commented@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"
Comment #26
bradyemerson commented@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.
Comment #27
scuis commentedI 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));
Comment #28
vipul tulse commentedGreetings
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.