From 13c0c5d9b275f96dbce84f0e3193128c1a9a3cd6 Mon Sep 17 00:00:00 2001 From: PromInc Date: Thu, 7 Jan 2016 06:52:49 -0600 Subject: [PATCH 1/2] Data Import Debug Use for DEBUG MODE only. Update the following URL with the path to your installation directory and the domain you wish to capture data from. http://localhost/organic-search-analytics/data-capture-run.php?type=goog leSearchAnalytics&domain=yourwebsite.com&date=2015-12-30 WARNING - this will import data for the date selected and thus will have skew your data for that day. This should be performed on a test database/installation else be prepared to delete the false data that is captured for that day. --- organic-search-analytics/inc/code/wmtimport.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/organic-search-analytics/inc/code/wmtimport.php b/organic-search-analytics/inc/code/wmtimport.php index 854f5e9..1e39bb9 100644 --- a/organic-search-analytics/inc/code/wmtimport.php +++ b/organic-search-analytics/inc/code/wmtimport.php @@ -58,6 +58,7 @@ public function getDataFromReportName($fileName) * @returns Int Count of records imported */ public function importGoogleSearchAnalytics($domain, $date, $searchType, $searchAnalytics) { + echo "

Import data for search type: ".$searchType."

"; $countImport = 0; foreach( $searchAnalytics->rows as $recordKey => $recordData ) { /* Prep data */ @@ -68,10 +69,24 @@ public function importGoogleSearchAnalytics($domain, $date, $searchType, $search $import = "INSERT into ".MySQL::DB_TABLE_SEARCH_ANALYTICS."(domain, date, search_engine, search_type, device_type, query, impressions, clicks, ctr, avg_position) values('$domain', '$date', 'google', '$searchType', '$deviceType', '{$query}','{$recordData['impressions']}','{$recordData['clicks']}','{$recordData['ctr']}','{$recordData['position']}')"; - if( $GLOBALS['db']->query($import) ) { + echo "Record #".$countImport."
"; + echo $import."
"; + $result = $GLOBALS['db']->query($import); + var_dump($result); + echo "
"; + + if( $result ) { $countImport++; + } else { + echo "
";
+					var_dump($result);
+					echo "
"; } + + echo "----------
"; + } + echo "

Total records imported: ".$countImport."

"; return $countImport; } From 4ce69a81940b42accd4cb57c5728af0f1299bc01 Mon Sep 17 00:00:00 2001 From: PromInc Date: Thu, 7 Jan 2016 07:01:48 -0600 Subject: [PATCH 2/2] Update record count update --- organic-search-analytics/inc/code/wmtimport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/organic-search-analytics/inc/code/wmtimport.php b/organic-search-analytics/inc/code/wmtimport.php index 1e39bb9..468bdbe 100644 --- a/organic-search-analytics/inc/code/wmtimport.php +++ b/organic-search-analytics/inc/code/wmtimport.php @@ -69,7 +69,7 @@ public function importGoogleSearchAnalytics($domain, $date, $searchType, $search $import = "INSERT into ".MySQL::DB_TABLE_SEARCH_ANALYTICS."(domain, date, search_engine, search_type, device_type, query, impressions, clicks, ctr, avg_position) values('$domain', '$date', 'google', '$searchType', '$deviceType', '{$query}','{$recordData['impressions']}','{$recordData['clicks']}','{$recordData['ctr']}','{$recordData['position']}')"; - echo "Record #".$countImport."
"; + echo "Record #".$recordKey."
"; echo $import."
"; $result = $GLOBALS['db']->query($import); var_dump($result);