
Contents
Understanding expected goals (xG)
Expected goals (xG) is a football stat that shows how likely a shot is to become a goal. It gives each shot a score (between 0 and 1) based on how good the chance is, using past data and the situation of the shot.
What does xG measure?
Each shot is given an xG value:
– 0 means almost no chance of scoring.
– 1 means a goal is almost certain.
Examples:
– A simple tap-in: xG of 0.90 (90% chance of scoring).
– A long shot from far away: xG of 0.05 (5% chance of scoring).
What affects xG?
Several things impact a shot’s xG score:
– Shot location: Closer and more central = higher xG.
– Shot angle: A narrow angle = lower xG.
– Type of assist: Clean passes (like through balls) = higher xG than messy crosses.
– Defender pressure: More pressure = lower xG.
– Body part used: Foot shots usually have higher xG than headers.
xG vs. actual goals
Comparing xG to actual goals can show how well a player or team is performing:
– Overperformance: More goals than xG suggests = great finishing or luck.
– Underperformance: Fewer goals than xG = poor finishing or bad luck.
This helps teams see if results match their performance or if changes are needed.
Why xG matters
xG gives deeper insight than just looking at goals scored. It helps with:
– Evaluating performance: Are the chances good, even if the team didn’t win?
– Tactical analysis: Spot strong and weak areas in attack or defence.
– Predictions: Estimate future results based on chance quality.
Accessing Sportmonks xG data
To use Sportmonks’ expected goals (xG) data for prediction and analysis, you need to access it through our API. This section explains how to get your API token, choose the right xG add-on, and use the correct endpoints.
Getting your API token
To use the Sportmonks football API, you need an API token. Here’s how to get it:
- Create an account: Go to MySportmonks and sign up.
- Generate your token: After logging in, find the “API Token” section in your settings and create your token.
- Store your token safely: The token is only shown once. Keep it safe and don’t share it.
Tip: Use a backend or proxy server to keep your token hidden in frontend apps.
Choosing an xG Metrics add-on
Sportmonks offers xG data in three different add-on levels:
– Basic: xG per fixture, available 12 hours after the match.
– Standard: xG and xG on Target per fixture, available right after the match.
– Advanced: Real-time and detailed xG data, including: xG per Fixture, xG on Target, Non-Penalty xG, xG Open Play, xG Set Play. xG Corners, xG Free Kicks, xG Penalties, Expected Points (xPTS), Expected Goals Conceded, Expected Goal Difference, Over/Underperformance, Expected Goals Saved
How to subscribe:
- Log in: Go to your MySportmonks account.
- Pick a football API plan: Choose the plan that suits your needs.
- Add the xG package: During setup, select either Basic, Standard or Advanced as an add-on.
The type of xG data you get depends on the package you choose.
Using the correct API endpoints
Once you have your token and xG add-on, you can get the data through these endpoints:
🟢 Team-level xG data
Endpoint:
https://api.sportmonks.com/v3/football/expected/fixtures
What it does:
Returns expected goals (xG) stats for each team in every match.
🟢 Player-level xG data
Endpoint:
https://api.sportmonks.com/v3/football/expected/lineups
What it does:
Returns expected goals (xG) stats for each player per match.
When you make API calls, include your API token. You can send it either in the query parameters or as a bearer token in the request header.
Retrieving xG data using the API
Once you’ve got your Sportmonks football API token and added the xG Metrics add-on, you’re ready to start pulling xG data. Follow these steps to make the most of the API.
Step 1: Pick the right endpoint
There are two main options depending on the data you need:
– Team-level xG data
https://api.sportmonks.com/v3/football/expected/fixtures
Returns expected goals (xG) for each team in a fixture.
– Player-level xG data
https://api.sportmonks.com/v3/football/expected/lineups
Returns expected goals (xG) for each player in a fixture.
Choose based on your goal:
– Use team data to analyse overall team performance.
– Use player data for individual stats.
Step 2: Make the API request
You must include your API token in each request.
Example for team xG data:
https://api.sportmonks.com/v3/football/expected/fixtures?api_token=YOUR_API_TOKEN
Replace YOUR_API_TOKEN with your real token from your Sportmonks account.
Step 3: Add extra data with “includes”
You can expand the response by adding the include parameter.
– For team xG in a fixture:
https://api.sportmonks.com/v3/football/fixtures/{fixture_id}?api_token=YOUR_API_TOKEN&include=xGFixture
– For player xG in a fixture:
https://api.sportmonks.com/v3/football/fixtures/{fixture_id}?api_token=YOUR_API_TOKEN&include=lineups.xGLineup
Replace {fixture_id} with the actual match ID.
Step 4: Understand the API response
The data is returned in JSON format. Here’s a basic example of what you might see for team-level xG:
{ "data": { "id": 19380880, "xgfixture": [ { "type": { "name": "Expected Goals (xG)" }, "data": { "value": 1.7922 } }, { "type": { "name": "Expected Goals on Target (xGoT)" }, "data": { "value": 3.1765 } } ] } }
This means the team had an xG of 1.7922. Their xGoT (xG on Target) was 3.1765
Analysing xG data for predictive insights
Once you’ve pulled expected goals (xG) data using the Sportmonks football API, the next step is to analyse it. This helps you understand team and player performance, and can support decisions in tactics, betting models, or scouting.
Combine xG data across matches
Looking at xG from several games helps you spot patterns and trends. It gives a clearer picture than relying on just one match.
– Team-level analysis: Find the average xG per match across a season to see how effective a team is in attack.
– Player-level analysis: Add up each player’s xG over multiple matches to understand how much they contribute in front of goal.
This method helps smooth out any unusual results from a single match.
Compare xG with actual goals
By comparing xG to actual goals scored, you can see how well players or teams are finishing their chances.
– Overperformance: If a team scores more than expected, they may be finishing very well or simply getting lucky.
– Underperformance: Scoring less than expected could mean poor finishing or bad luck, possibly pointing to an area that needs improvement.
This helps predict whether current results are likely to continue or not.
Use advanced xG metrics
Sportmonks also offers more detailed stats for deeper insights:
– Expected Goals on Target (xGoT): Measures the quality of shots that actually hit the target, a better post-shot measure.
– Non-Penalty xG (npxG): Removes penalty kicks from the data, showing how good a team or player is during open play or set pieces.
– xG Open Play (xGOP) and xG Set Play (xGSP): Splits the xG based on when the shot happened, in open play or after a set piece.
– Expected Points (xPTS): Estimates how many points a team should have earned, based on the quality of chances in each match.
Using these extra metrics gives more depth to your analysis.
Visualise your xG data
Turning xG numbers into charts makes the data easier to understand and share:
– xG timelines: Show how xG builds up during a match, highlighting when a team was on top.
– Shot maps: Plot where shots were taken and their xG value, useful for seeing shooting habits.
– xG vs actual goals charts: Compare what a team or player should have scored with what they actually scored, great for spotting form trends.
Building predictive models with xG data
Expected goals (xG) is a key tool in football analytics. Using Sportmonks’ detailed xG data, you can build models that predict match results, analyse team strength, and even simulate entire tournaments.
Why xG is useful in predictions
xG tells you how likely each shot is to become a goal. When used in predictive models, it helps to:
– Predict match outcomes: Compare the xG values of both teams to estimate who’s more likely to win.
– Evaluate team performance: Use xG data from several matches to spot trends, like strong attacks or weak defences.
– Simulate tournaments: Model likely results through each round based on xG data.
Sportmonks’ xG data can also be added to machine learning models to boost prediction accuracy by combining it with stats like form, player performance, and past results.
Steps to build a predictive model with Sportmonks xG
- Collect data Use Sportmonks API endpoints like GET Expected by Team and GET Expected by Player
- Prepare the data: Clean the data, fix missing values, and make sure all numbers are in a consistent format.
- Create useful features: Add extra context, such as recent xG form (Home vs away performance and player injuries or absences)
- Choose your model: Pick a machine learning algorithm that fits your data. Common choices include Logistic regression, Random forests and Gradient boosting
- Train and test: Split the data into a training set and a validation set to test accuracy and avoid overfitting.
- Evaluate performance: Use metrics like accuracy, precision, recall and F1-score
- Deploy the model: Use it in an app, dashboard, or report to provide live predictions or regular insights.
Real-world applications and case studies
Sportmonks’ expected goals (xG) data is helping reshape how football is analysed and enjoyed. From fan apps to professional tools, its impact is wide and growing.
Boosting fan engagement
Companies like ShiftOneZero use Sportmonks’ real-time xG data to build advanced apps for clubs such as Dinamo Zagreb. These apps give fans:
– Real-time match stats
– In-depth xG insights
– A more interactive and informative matchday experience
The result: fans feel more involved and informed while watching games.
Powering betting and fantasy sports platforms
Betting and fantasy apps rely on xG data to offer:
– Better predictions
– More accurate odds
– Fairer and clearer player evaluations
This extra layer of insight builds user trust and improves decision-making for fans and players alike.
Helping scouts and coaches
Professional teams and talent scouts use xG metrics to:
– Spot players who regularly create or stop quality chances
– Make better recruitment and tactical decisions
– Track consistent performance over time
xG data offers a more objective way to measure impact on the pitch.
Case study: Scoreplay’s automation success
Scoreplay, a platform that uses AI for media management, integrated Sportmonks’ API to:
– Automatically pull player profiles and match schedules
– Remove the need for manual data entry
– Increase speed and efficiency in daily tasks
This case shows how even behind-the-scenes operations benefit from smart use of xG and match data.
Use xG insights to make smarter football decisions
Expected goals (xG) is a powerful tool that shows the real value of every shot. Whether you’re predicting match outcomes, scouting players, or building better fan experiences, xG helps you see what the scoreline doesn’t.
With Sportmonks’ flexible xG add-ons and easy-to-use API, you’ll have access to the same high-quality stats trusted by top analysts, from team trends to detailed player insights.
Start with Sportmonks today and turn raw data into clear, smart football decisions.