feat(seo): Add GSC setup instructions when token exists but no data
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

- SEO dashboard: show step-by-step guide when GSC connected but site
  not found in Search Console (instead of generic "connect" CTA)
- Integrations page: add info note about GSC site verification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-08 19:03:58 +01:00
parent ac984b50a6
commit 53e4352c40
3 changed files with 43 additions and 3 deletions

View File

@ -12,7 +12,7 @@ from flask_login import current_user, login_required
from database import (
SessionLocal, Company, CompanyWebsiteAnalysis,
CompanySocialMedia, ITAudit, CompanyCitation, GBPReview
CompanySocialMedia, ITAudit, CompanyCitation, GBPReview, OAuthToken
)
from . import bp
@ -177,6 +177,13 @@ def seo_audit_dashboard(slug):
'citations': [{'directory_name': c.directory_name, 'listing_url': c.listing_url, 'status': c.status, 'nap_accurate': c.nap_accurate} for c in citations],
}
# Check if company has GSC OAuth token
has_gsc_token = db.query(OAuthToken).filter(
OAuthToken.company_id == company.id,
OAuthToken.provider == 'google',
OAuthToken.service == 'search_console'
).first() is not None
# Determine if user can run audit (user with company edit rights)
can_audit = current_user.can_edit_company(company.id)
@ -185,7 +192,8 @@ def seo_audit_dashboard(slug):
return render_template('seo_audit.html',
company=company,
seo_data=seo_data,
can_audit=can_audit
can_audit=can_audit,
has_gsc_token=has_gsc_token
)
finally:

View File

@ -375,6 +375,11 @@
{% if sc_conn.get('account_name') %}
<p class="oauth-account-name">Konto: {{ sc_conn.account_name }}</p>
{% endif %}
<div style="margin: 8px 0; padding: 10px 12px; background: #eff6ff; border-radius: 8px; font-size: 12px; color: #1e40af; line-height: 1.6;">
<strong>Wazne:</strong> Twoja strona musi byc dodana i zweryfikowana w
<a href="https://search.google.com/search-console" target="_blank" rel="noopener" style="color: #2563eb; font-weight: 600;">Google Search Console</a>.
Po weryfikacji dane pojawia sie w audycie SEO po 2-3 dniach.
</div>
<div class="oauth-card-actions">
<button class="btn-oauth disconnect" onclick="disconnectOAuth('google', 'search_console')">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"/><line x1="12" y1="2" x2="12" y2="12"/></svg>

View File

@ -746,8 +746,35 @@
</div>
{% endif %}
</div>
{% elif has_gsc_token %}
<!-- GSC connected but no data yet -->
<h2 class="section-title">
<svg width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
Google Search Console
<span style="font-size: var(--font-size-xs); background: #4285f4; color: white; padding: 2px 8px; border-radius: 12px; font-weight: 500; margin-left: 8px;">OAuth</span>
</h2>
<div style="background: var(--surface); padding: var(--spacing-lg); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: var(--spacing-xl);">
<div style="display: flex; align-items: flex-start; gap: var(--spacing-md); padding: var(--spacing-md); background: #fef3c7; border-radius: var(--radius-md); margin-bottom: var(--spacing-md);">
<svg width="24" height="24" fill="none" stroke="#d97706" viewBox="0 0 24 24" style="flex-shrink: 0; margin-top: 2px;">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4.5c-.77-.833-2.694-.833-3.464 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
<div>
<p style="margin: 0 0 4px 0; font-weight: 600; color: #92400e; font-size: var(--font-size-sm);">Konto polaczone, ale brak danych</p>
<p style="margin: 0; color: #78350f; font-size: var(--font-size-xs);">Twoja strona moze nie byc jeszcze dodana do Google Search Console. Wykonaj ponizsze kroki:</p>
</div>
</div>
<ol style="margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: var(--font-size-xs); line-height: 1.8;">
<li>Wejdz na <a href="https://search.google.com/search-console" target="_blank" rel="noopener" style="color: #4285f4; font-weight: 500;">search.google.com/search-console</a></li>
<li>Kliknij <strong>Dodaj wlasciwosc</strong> i wpisz adres strony: <code style="background: #f3f4f6; padding: 2px 6px; border-radius: 4px;">{{ company.website or '' }}</code></li>
<li>Zweryfikuj wlasciwosc (najlatwiej przez <strong>rekord DNS TXT</strong> lub <strong>tag HTML</strong>)</li>
<li>Poczekaj 2-3 dni az Google zbierze pierwsze dane</li>
<li>Uruchom ponownie audyt SEO — dane pojawia sie tutaj automatycznie</li>
</ol>
</div>
{% else %}
<!-- GSC CTA - no data available -->
<!-- GSC not connected -->
<div style="background: var(--surface); padding: var(--spacing-lg); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: var(--spacing-xl); text-align: center;">
<svg width="32" height="32" fill="none" stroke="#9ca3af" viewBox="0 0 24 24" style="margin-bottom: var(--spacing-sm);">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>