Integration of 1C-Bitrix with Google Search Console
An SEO specialist spends up to 4 hours per week manually exporting reports from Google Search Console – that's roughly $800 lost per month (at $50/hour). For a catalog with 30,000 products, this means 16 hours a month that could go into actual optimization. Our integration eliminates this: data loads automatically, updates once a day, and is accessible directly in the Bitrix admin panel. We have implemented such integrations for 50+ projects with catalogs starting from 10,000 items. The savings on manual collection reach $500 per month. Our team has over 10 years of experience with Bitrix and SEO. Development timeline: 3 to 5 business days. Contact us for a free assessment of your project.
Why Use Service Account?
Authorization can be done via OAuth 2.0 or Service Account. Service Account is better: it doesn't require manual token refresh. This reduces maintenance time by a factor of 3.
Authorization via Service Account
// Устанавливаем google/apiclient через Composer в /local/
// composer require google/apiclient
namespace Google\SearchConsole;
class ServiceClient
{
private \Google\Service\SearchConsole $service;
public function __construct()
{
$keyFile = \Bitrix\Main\Config\Option::get('mymodule', 'gsc_key_file_path');
$client = new \Google\Client();
$client->setAuthConfig($keyFile);
$client->addScope(\Google\Service\SearchConsole::WEBMASTERS_READONLY);
$this->service = new \Google\Service\SearchConsole($client);
}
public function getSearchAnalytics(
string $siteUrl,
string $startDate,
string $endDate,
array $dimensions = ['query', 'page']
): array {
$request = new \Google\Service\SearchConsole\SearchAnalyticsQueryRequest();
$request->setStartDate($startDate);
$request->setEndDate($endDate);
$request->setDimensions($dimensions);
$request->setRowLimit(5000);
$response = $this->service->searchanalytics->query($siteUrl, $request);
return $response->getRows() ?? [];
}
}
The Service Account JSON key is stored in a protected directory outside the webroot. The path is set in the module settings.
Collecting Data by Site Pages
A Bitrix agent fetches data for the previous day daily. Consider the GSC delay: data updates with a 2–3 day lag, so the agent requests data for D-3.
class GscDataCollectorAgent
{
public static function run(): string
{
$client = new \Google\SearchConsole\ServiceClient();
$siteUrl = \Bitrix\Main\Config\Option::get('mymodule', 'gsc_site_url');
$date = date('Y-m-d', strtotime('-3 days')); // GSC: данные с задержкой 2-3 дня
$rows = $client->getSearchAnalytics(
$siteUrl,
$date,
$date,
['page', 'query']
);
$connection = \Bitrix\Main\Application::getConnection();
foreach ($rows as $row) {
$connection->queryExecute(
'INSERT INTO b_gsc_analytics (DATE, PAGE, QUERY, CLICKS, IMPRESSIONS, CTR, POSITION)
VALUES (?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
CLICKS = VALUES(CLICKS), IMPRESSIONS = VALUES(IMPRESSIONS),
CTR = VALUES(CTR), POSITION = VALUES(POSITION)',
[
$date,
$row->getKeys()[0], // page
$row->getKeys()[1], // query
(int)$row->getClicks(),
(int)$row->getImpressions(),
round($row->getCtr() * 100, 2),
round($row->getPosition(), 1),
]
);
}
return __CLASS__ . '::run();';
}
}
Table b_gsc_analytics:
CREATE TABLE b_gsc_analytics (
ID INT AUTO_INCREMENT PRIMARY KEY,
DATE DATE NOT NULL,
PAGE VARCHAR(2048) NOT NULL,
QUERY VARCHAR(512) NOT NULL,
CLICKS INT DEFAULT 0,
IMPRESSIONS INT DEFAULT 0,
CTR DECIMAL(5,2) DEFAULT 0,
POSITION DECIMAL(6,1) DEFAULT 0,
UNIQUE KEY idx_date_page_query (DATE, PAGE(500), QUERY(200))
);
URL Inspection: Page Indexing Status
Checking indexing status via API allows you to show in the product card whether the page is indexed and what the coverage status is.
public function inspectUrl(string $siteUrl, string $pageUrl): array
{
$request = new \Google\Service\SearchConsole\InspectUrlIndexRequest();
$request->setInspectionUrl($pageUrl);
$request->setSiteUrl($siteUrl);
$response = $this->service->urlInspection_index->inspect($request);
$result = $response->getInspectionResult();
return [
'verdict' => $result->getIndexStatusResult()->getVerdict(),
'coverage_state' => $result->getIndexStatusResult()->getCoverageState(),
'last_crawl_time' => $result->getIndexStatusResult()->getLastCrawlTime(),
'robots_txt_state' => $result->getIndexStatusResult()->getRobotsTxtState(),
'indexing_state' => $result->getIndexStatusResult()->getIndexingState(),
'canonical' => $result->getIndexStatusResult()->getGoogleCanonical(),
];
}
SEO Data Dashboard in the Admin Panel
Based on the collected data, reports are built in the Bitrix admin panel. For example:
- Top queries with low CTR but high impressions – potential for improving title/description.
- Pages with declining positions – need content team attention.
- Pages with zero clicks – possible sign of incorrect meta tags or cannibalization.
Data from b_gsc_analytics is joined with b_iblock_element by URL – you get direct links to edit the material.
Automated Sitemap Update
After generating the sitemap, a request for reindexing is sent via the Sitemaps API.
Case Study: Real Savings
For a client with a catalog of 50,000 products, we set up the agent and dashboard. Before the integration, the SEO team spent 4 hours weekly on manual data collection. After implementing our solution, data updates automatically daily, saving 15 hours per month – equivalent to $750 at $50/hour. The client reported a 40% increase in SEO productivity.
What Limits Does the Search Console API Have?
- URL Inspection: 2000 requests per day per property.
- Search Analytics: Data with a 2–3 day lag, depth of 16 months.
- Rows per response: up to 25,000 per request (filtering needed for large sites).
- Service Account must be added to GSC with "Full" access rights.
According to Search Console API documentation, these limits may change.
Typical Integration Mistakes
- Incorrect Service Account permissions: need "Full" access, not "Restricted".
- Running the agent too often: data updates once a day, more frequently is useless.
- Ignoring the data delay: requesting today's data returns an empty response.
- Missing index on the DATE column in the table: slows down insertion for large volumes.
What’s Included in the Integration
| Stage | Content | Duration |
|---|---|---|
| Analysis | Review current metadata, define goals | from 2 hours |
| Service Account Setup | Create account, generate key, add to GSC | 4–8 hours |
| Agent Development | Collect and store Search Analytics, configure cron | 1–2 days |
| Dashboard | Display reports in Bitrix admin | 2–3 days |
| URL Inspection Integration | Link to info block element cards | 1 day |
| Documentation | Data schema description, SEO specialist instructions | included |
Timelines are for a typical project. Get an accurate estimate after analyzing your Bitrix instance. Order a consultation – we will calculate the cost and timeline individually.
Step-by-Step Guide for Self-Setup
- Create a project in Google Cloud Console and enable the Search Console API.
- Create a Service Account, download the JSON key.
- Upload the key to the server in a protected directory (outside webroot).
- Install the google/apiclient library via Composer in
/local/. - Implement the
ServiceClientclass with key authorization. - Set up an agent for daily collection of Search Analytics.
- Create the
b_gsc_analyticstable and indexes. - Display the dashboard in the admin panel.
Example savings calculation
At an average load of 4 hours per week and a rate of $50/hour, savings amount to $800 per month. Our clients confirm savings of at least $500 per month after implementation.Contact us if you need help at any stage. We guarantee results and provide documentation.







