feat: expand Facebook data collection with all available fields
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
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
Added: talking_about_count, username, verification_status, price_range, category_list, page_posts_impressions, video_views, daily_follows/unfollows. Updated audit detail UI with new data sections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
147f36ab75
commit
e07556fd22
@ -47,9 +47,10 @@ class FacebookGraphService:
|
||||
def get_page_info(self, page_id: str) -> Optional[Dict]:
|
||||
"""Get detailed page information."""
|
||||
return self._get(page_id, {
|
||||
'fields': 'id,name,fan_count,category,link,about,description,website,phone,emails,'
|
||||
'fields': 'id,name,fan_count,category,category_list,link,about,description,website,phone,emails,'
|
||||
'single_line_address,location,hours,followers_count,picture,cover,'
|
||||
'rating_count,overall_star_rating,were_here_count,founded,mission'
|
||||
'rating_count,overall_star_rating,were_here_count,founded,mission,'
|
||||
'talking_about_count,username,verification_status,is_verified,price_range'
|
||||
})
|
||||
|
||||
def get_page_posts_stats(self, page_id: str) -> Dict:
|
||||
@ -131,6 +132,10 @@ class FacebookGraphService:
|
||||
'page_views_total',
|
||||
'page_post_engagements',
|
||||
'page_actions_post_reactions_total',
|
||||
'page_posts_impressions',
|
||||
'page_video_views',
|
||||
'page_daily_follows',
|
||||
'page_daily_unfollows',
|
||||
# These may be deprecated or require additional permissions:
|
||||
'page_impressions',
|
||||
'page_engaged_users',
|
||||
@ -603,6 +608,19 @@ def sync_facebook_to_social_media(db, company_id: int) -> dict:
|
||||
extra['overall_star_rating'] = page_info['overall_star_rating']
|
||||
if page_info.get('were_here_count'):
|
||||
extra['were_here_count'] = page_info['were_here_count']
|
||||
# Additional page info fields
|
||||
if page_info.get('talking_about_count'):
|
||||
extra['talking_about_count'] = page_info['talking_about_count']
|
||||
if page_info.get('username'):
|
||||
extra['username'] = page_info['username']
|
||||
if page_info.get('verification_status'):
|
||||
extra['verification_status'] = page_info['verification_status']
|
||||
if page_info.get('is_verified') is not None:
|
||||
extra['is_verified'] = page_info['is_verified']
|
||||
if page_info.get('price_range'):
|
||||
extra['price_range'] = page_info['price_range']
|
||||
if page_info.get('category_list'):
|
||||
extra['category_list'] = [c.get('name') for c in page_info['category_list'] if c.get('name')]
|
||||
# Post engagement stats
|
||||
extra['total_likes'] = post_stats.get('total_likes', 0)
|
||||
extra['total_comments'] = post_stats.get('total_comments', 0)
|
||||
@ -614,7 +632,8 @@ def sync_facebook_to_social_media(db, company_id: int) -> dict:
|
||||
# Insights
|
||||
for key in ('page_impressions', 'page_engaged_users', 'page_views_total',
|
||||
'page_post_engagements', 'page_fan_adds', 'page_fan_removes',
|
||||
'page_actions_post_reactions_total'):
|
||||
'page_actions_post_reactions_total', 'page_posts_impressions',
|
||||
'page_video_views', 'page_daily_follows', 'page_daily_unfollows'):
|
||||
if insights.get(key):
|
||||
extra[f'insights_{key}'] = insights[key]
|
||||
csm.content_types = extra
|
||||
|
||||
@ -744,7 +744,10 @@
|
||||
{% if ct.get('website') %}{% if info_fields.append(('🌐', ct.website)) %}{% endif %}{% endif %}
|
||||
{% if ct.get('category') %}{% if info_fields.append(('🏷️', ct.category)) %}{% endif %}{% endif %}
|
||||
{% if ct.get('founded') %}{% if info_fields.append(('📅', 'Założono: ' ~ ct.founded)) %}{% endif %}{% endif %}
|
||||
{% if ct.get('price_range') %}{% if info_fields.append(('💰', 'Ceny: ' ~ ct.price_range)) %}{% endif %}{% endif %}
|
||||
{% if ct.get('hours') %}{% if info_fields.append(('🕐', 'Godziny otwarcia ustawione')) %}{% endif %}{% endif %}
|
||||
{% if ct.get('username') %}{% if info_fields.append(('🔗', '@' ~ ct.username)) %}{% endif %}{% endif %}
|
||||
{% if ct.get('verification_status') == 'blue_verified' or ct.get('is_verified') %}{% if info_fields.append(('✅', 'Zweryfikowana')) %}{% endif %}{% endif %}
|
||||
{% if info_fields %}
|
||||
<div style="margin-top: var(--spacing-sm); display: flex; gap: var(--spacing-xs); flex-wrap: wrap;">
|
||||
{% for icon, val in info_fields %}
|
||||
@ -755,15 +758,21 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Ratings & Check-ins -->
|
||||
{% if ct.get('overall_star_rating') or ct.get('were_here_count') or ct.get('rating_count') %}
|
||||
<!-- Activity & Reach -->
|
||||
{% if ct.get('talking_about_count') or ct.get('overall_star_rating') or ct.get('were_here_count') or ct.get('category_list') %}
|
||||
<div style="margin-top: var(--spacing-sm); display: flex; gap: var(--spacing-md); flex-wrap: wrap; font-size: var(--font-size-sm);">
|
||||
{% if ct.get('talking_about_count') %}
|
||||
<span>🗣️ {{ ct.talking_about_count }} osób mówi o stronie</span>
|
||||
{% endif %}
|
||||
{% if ct.get('overall_star_rating') %}
|
||||
<span>⭐ {{ ct.overall_star_rating }}/5 {% if ct.get('rating_count') %}({{ ct.rating_count }} ocen){% endif %}</span>
|
||||
{% endif %}
|
||||
{% if ct.get('were_here_count') %}
|
||||
<span>📌 {{ "{:,}".format(ct.were_here_count).replace(",", " ") }} zameldowań</span>
|
||||
{% endif %}
|
||||
{% if ct.get('category_list') %}
|
||||
<span>🏷️ {{ ct.category_list|join(', ') }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@ -788,16 +797,20 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Insights -->
|
||||
{% set has_insights = ct.get('insights_page_impressions') or ct.get('insights_page_views_total') or ct.get('insights_page_post_engagements') %}
|
||||
{% set has_insights = ct.get('insights_page_impressions') or ct.get('insights_page_views_total') or ct.get('insights_page_post_engagements') or ct.get('insights_page_posts_impressions') or ct.get('insights_page_daily_follows') %}
|
||||
{% if has_insights %}
|
||||
<div style="margin-top: var(--spacing-sm); padding: var(--spacing-sm) var(--spacing-md); background: #f0f9ff; border-radius: var(--radius); border: 1px solid #bae6fd;">
|
||||
<div style="font-size: 11px; font-weight: 600; color: #0369a1; margin-bottom: 4px;">📊 Insights (28 dni)</div>
|
||||
<div style="display: flex; gap: var(--spacing-md); flex-wrap: wrap; font-size: var(--font-size-sm); color: #0c4a6e;">
|
||||
{% if ct.get('insights_page_impressions') %}<span>{{ "{:,}".format(ct.insights_page_impressions).replace(",", " ") }} wyświetleń</span>{% endif %}
|
||||
{% if ct.get('insights_page_posts_impressions') %}<span>{{ "{:,}".format(ct.insights_page_posts_impressions).replace(",", " ") }} zasięg postów</span>{% endif %}
|
||||
{% if ct.get('insights_page_impressions') %}<span>{{ "{:,}".format(ct.insights_page_impressions).replace(",", " ") }} wyświetleń strony</span>{% endif %}
|
||||
{% if ct.get('insights_page_views_total') %}<span>{{ "{:,}".format(ct.insights_page_views_total).replace(",", " ") }} odsłon strony</span>{% endif %}
|
||||
{% if ct.get('insights_page_post_engagements') %}<span>{{ "{:,}".format(ct.insights_page_post_engagements).replace(",", " ") }} interakcji</span>{% endif %}
|
||||
{% if ct.get('insights_page_video_views') %}<span>{{ "{:,}".format(ct.insights_page_video_views).replace(",", " ") }} odsłon wideo</span>{% endif %}
|
||||
{% if ct.get('insights_page_daily_follows') %}<span>+{{ ct.insights_page_daily_follows }} nowych obserwujących</span>{% endif %}
|
||||
{% if ct.get('insights_page_daily_unfollows') %}<span>-{{ ct.insights_page_daily_unfollows }} utraconych</span>{% endif %}
|
||||
{% if ct.get('insights_page_fan_adds') %}<span>+{{ ct.insights_page_fan_adds }} nowych fanów</span>{% endif %}
|
||||
{% if ct.get('insights_page_fan_removes') %}<span>-{{ ct.insights_page_fan_removes }} utraconych</span>{% endif %}
|
||||
{% if ct.get('insights_page_fan_removes') %}<span>-{{ ct.insights_page_fan_removes }} utraconych fanów</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user