It's useful to know when you have a new website referrer. Google Analytics is plagued with spam referral and you want to filter this out of reporting as quickly as possible to stop it from skewing your data. It's also helpful to be able to respond quickly to new referral traffic - maybe leave a comment or promote the new link on social media.
The script below will send you a daily email with links to any new referrers.
Choose Advanced Google Services from the Resources menu and switch on the Google Analytics API. Then click the Google API Console link and enable the Google Analytics API there as well.
Finally pick Current project's triggers from the Edit menu and trigger the main function daily at a convenient time.
This script saves known referrers in script properties. For a site with lots of traffic this may run out of space in which case you might need to switch this out and write known referrers to a sheet instead.
More Google Apps Script Projects
- Export Google Fit Daily Steps, Weight and Distance to a Google Sheet
- How to backup Google Photos to Google Drive automatically after July 2019 with Apps Script
- Get an email when your security camera sees something new (Apps Script + Cloud Vision)
- Automate Google PageSpeed Insights with Apps Script
- Get an email if your site stops being mobile friendly
- Using the Azure Monitor REST API from Google Apps Script