Analiza sentimenta na X-u
Na ovoj stranici
Shvati što tvoja publika doista misli
Analiza sentimenta pretvara tisuće objava u jasan uvid u to kako se percipiraju tvoja marka, konkurenti ili industrija. Uz X Search i mogućnosti rezoniranja Groka, možeš ići dalje od jednostavne klasifikacije pozitivno/negativno te razumjeti emocionalne nijanse, skrivene frustracije i signale upozorenja.
Dimenzije sentimenta u marketingu
Analiza marketing sentimenta nadilazi binarni sustav pozitivno/negativno. Evo relevantnih dimenzija:
Ljestvica sentimenta s 5 razina
- Vrlo pozitivno: oduševljenje, aktivno preporučivanje, ljubav prema marki
- Pozitivno: zadovoljstvo, odobravanje, interes
- Neutralno: činjenični spomen, dijeljenje informacija
- Negativno: razočaranje, kritika, frustracija
- Vrlo negativno: bijes, poziv na bojkot, kriza
Dodatne dimenzije
- Namjera kupnje: Ukazuje li objava na namjeru kupnje ili odjave?
- Utjecaj: Potječe li objava s utjecajnog računa ili od prosječnog potrošača?
- Viralnost: Ima li objava potencijal širenja?
- Hitnost: Zahtijeva li signal brzu reakciju?
Analiziraj sentiment pomoću X Searcha i Groka
Analiza sentimenta za tvoju marku
def analyser_sentiment_marque(marque, periode_jours=7):
from datetime import datetime, timedelta
today = datetime.now().strftime("%Y-%m-%d")
start = (datetime.now() - timedelta(days=periode_jours)).strftime("%Y-%m-%d")
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input=f"""Analyze the sentiment of conversations on X
about {marque} between {start} and {today}.
For each conversation theme identified, provide:
1. The theme (e.g., "customer service", "product quality")
2. The dominant sentiment (1-5 scale)
3. The estimated conversation volume
4. The most representative verbatims
5. The most influential accounts in the discussion
6. Sentiment evolution over the period
Final summary:
- Global sentiment score (1-5)
- Top 3 positive points
- Top 3 negative points
- Any alerts""",
tools=[{
"type": "x_search",
"from_date": start,
"to_date": today
}]
)
return response.output_text
Komparativna analiza sentimenta
Usporedi percepciju svoje marke s percepcijom konkurenata:
def sentiment_comparatif(marques, periode_jours=30):
from datetime import datetime, timedelta
today = datetime.now().strftime("%Y-%m-%d")
start = (datetime.now() - timedelta(days=periode_jours)).strftime("%Y-%m-%d")
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input=f"""Compare sentiment on X for these brands:
{', '.join(marques)}
Period: {start} to {today}
For each brand, evaluate:
- Global sentiment score (1-5, with decimal)
- Dominant positive themes
- Dominant negative themes
- Strengths perceived by the public
- Weaknesses perceived by the public
Final comparison table ranked by sentiment.
Identify positioning opportunities for the
first brand in the list.""",
tools=[{"type": "x_search", "from_date": start, "to_date": today}]
)
return response.output_text
Dobij strukturirane rezultate u JSON-u
Da bi integrirao analizu sentimenta u podatkovni cjevovod, zatraži JSON izlaz:
def sentiment_structure(marque, periode_jours=7):
from datetime import datetime, timedelta
today = datetime.now().strftime("%Y-%m-%d")
start = (datetime.now() - timedelta(days=periode_jours)).strftime("%Y-%m-%d")
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input=f"""Analyze sentiment on X about {marque}.
Period: {start} to {today}.
Respond ONLY in valid JSON with this structure:
{{
"brand": "{marque}",
"period": "{start} - {today}",
"global_score": 3.7,
"distribution": {{
"very_positive": 15,
"positive": 35,
"neutral": 30,
"negative": 15,
"very_negative": 5
}},
"themes": [
{{
"name": "customer service",
"score": 2.1,
"volume": "high",
"trend": "stable"
}}
],
"alerts": ["alert description if applicable"],
"recommendations": ["recommended action"]
}}""",
tools=[{"type": "x_search", "from_date": start, "to_date": today}]
)
return response.output_text
Prati evoluciju sentimenta kroz vrijeme
Jednokratna analiza je korisna, ali praćenje kroz vrijeme otkriva trendove. Uspoređuj rezultate iz tjedna u tjedan:
def evolution_sentiment(marque, nb_semaines=4):
from datetime import datetime, timedelta
import json
historique = []
for i in range(nb_semaines, 0, -1):
end = (datetime.now() - timedelta(weeks=i-1)).strftime("%Y-%m-%d")
start = (datetime.now() - timedelta(weeks=i)).strftime("%Y-%m-%d")
response = client.responses.create(
model="grok-4.20-0309-reasoning",
input=f"""Sentiment score on X for {marque}
from {start} to {end}.
Respond with a JSON: {{"week": "{start}",
"score": X.X, "volume": N, "dominant_theme": "..."}}""",
tools=[{
"type": "x_search",
"from_date": start,
"to_date": end
}]
)
historique.append(response.output_text)
return historique
Otkrij krize reputacije
Analiza sentimenta tvoj je prvi sustav za uzbunu u slučaju krize:
def detecter_crise(marque, seuil_negatif=40):
resultat = sentiment_structure(marque, periode_jours=1)
# Parse the JSON
import json
data = json.loads(resultat)
pct_negatif = (data["distribution"]["negative"] +
data["distribution"]["very_negative"])
if pct_negatif > seuil_negatif:
return {
"alert": True,
"level": "CRITICAL" if pct_negatif > 60 else "IMPORTANT",
"score": data["global_score"],
"negative_themes": [t for t in data["themes"] if t["score"] < 2.5],
"recommendation": "Crisis meeting recommended"
}
return {"alert": False, "score": data["global_score"]}
Ključne točke
- Analiza sentimenta nadilazi pozitivno/negativno: procijeni namjeru, utjecaj i hitnost
- Koristi ljestvicu s 5 razina za hvatanje nijansi
- Zatraži strukturirane JSON izlaze za napajanje svojih nadzornih ploča
- Prati evoluciju sentimenta kroz vrijeme, a ne samo jednokratne snimke stanja
- Sustavno uspoređuj svoj sentiment s onim kod konkurenata
- Konfiguriraj pragove uzbune za rano otkrivanje kriza reputacije