By default Google Analytics (GA4) does not provide any embed code to show the analytics data on website front end. However this can be achieved by connecting your GA4 account with Looker Studio.
Looker Studio provides the emendable report URL which can be used in the website. To achieve this, refer below steps:
- Go to https://lookerstudio.google.com/navigation/reporting
- Choose “GA4 Report” from listed templates. This will open the default template with the data pre-populated
- Now click on “Use my own data” button on top right
- This will ask you to authorise the connection with your GA4 account. Click on “Authorize”
- Select the appropriate account and then click on “Add” button on the bottom right
- Select “Country”, “Company”, then accept the terms by ticking the checkbox and click on “Continue” button
- Choose Yes/No based on if you want to subscribe to any of Looker Studio newsletter topics and click on “Continue” button
- The popup will appear, click on “Add to report” button
- Now the template will populate the data from your GA4 account
- Click on “Edit and Share” button on top right
- Click on the small dropdown adjacent to “Share” button on the top right and then click on “Get report link”
- This will open a pop-up with a link which you can copy. Before that click on “View sharing setting” link shown in the popup.
- In the next step, choose “Public” or “Unlisted” as per your requirement
- Click on “Save”. Then click on the small dropdown that appears besides “Share” button, and click on “Embed Report”.
- Copy the Embed code and paste it in “HTML block” in your WordPress site. This will look like below.
Step by step tutorial – watch on the YouTube