10 Rules To Integrate Third-Party Scripts
The increasing importance of Google's Core Web Vital score increases the impact of third-party scripts on SEO rankings. Learn the best practices to stay on top!
Join the DZone community and get the full member experience.Join For Free
In reflection of this belief, Google has planned the gradual release of a major update to its search algorithm that is scheduled for June through August of 2021. This update will increase the importance of a page’s loading speed as a contributing factor to a web page’s overall ranking on Google’s search results page. As a result, how third-party scripts impact page load times is becoming more important than ever.
Don’t fear! There are a variety of steps you can take to improve your page load time and avoid getting marked down by Google. Below, I’ll provide 10 rules third-party script providers should follow to mitigate adverse effects caused by loading their scripts on customer web pages. But first, let’s start with a few basics you need to know in order to understand where to focus your energy.
Know Your Performance Ratings
Google has created a free tool known as PageSpeed Insights to help prepare site owners and builders for the upcoming change. To use PageSpeed Insights, simply input a URL to any given webpage. The tool will then analyze the site and calculate a page experience score, which I’ll cover in the next section.
Understand Page Experience Factors
Google’s new ranking signal is known as page experience, which indicates how “enjoyable” visiting a webpage may be for potential users. Google measures page experience using the following criteria:
- Mobile-friendliness: Including design, speed, navigation, and content flow.
- Safe browsing: Telling visitors and web developers if pages might be compromised.
- HTTPS implementation: Signaling whether or not a site makes a secure connection.
- Interstitial ad presence: Determining if a site includes adverts that block content or force user interaction.
- Core Web Vitals: NEW SIGNAL! Measuring both the speed and shifting of components on your website pages as they load into browsers.
Look Beyond SLAs
Setting up Service Level Agreements (SLA) that continuously measure speed and availability is paramount to hitting healthy page speed rankings. SLAs also help hold vendors accountable for their commitments. At the same time, SLAs alone may be insufficient for mitigating all risks.
External vendors can impact publishers in numerous ways, beyond page speed rankings. For example, vendor code execution can conflict with developer code, degrading the user experience for users of specific browsers or browser versions. Third-party resources can also deliver inappropriate content or harmful malware.
To help prevent such adverse impacts, we’ve put together our top 10 rules for creating and managing third-party scripts.
10 Rules For Creating Third-Party Scripts
1. Define and Enforce Meaningful SLAs
As a B2B service provider, you must establish clear SLAs. Ensure the SLAs are monitored and enforced so everyone across your organization understands the consequences of failure.
2. Use “ASYNC tags” to Avoid Blocking Content
3. Leverage Global Infrastructure for Content Delivery
Your clients place your tags on their pages and host visitors from various geographical regions. Accordingly, make your services reachable by catering to these locations. For example, U.S. West Coast servers aren’t ideal when your user base is primarily European. Strategically build your infrastructure by leaning on CDNs for static libraries and distributed DNS systems.
4. Write Safe Client-Side Code
5. Upload Content Security
Ensure that your system or service doesn't deliver malware, phishing, or viruses. You should also confirm that the content is website-appropriate. For example, you wouldn’t serve alcohol-related ads on kids’ websites.
6. Don’t Hide in the Shadows
7. Respect Both Client and End-User Privacy
8. Support all Modern Browsers and Devices
9. Don’t Hog Resources
Ensure your content doesn’t greedily consume bandwidth, CPU power, memory, or other resources. Remember that you’re not the sole page tag being used. Slowness does not serve the user and can be distracting from their primary content of interest. Minimalism and smart frugal resource utilization are crucial.
10. Create a Test Plan for New Releases
Test fresh tags and code on actual client web pages to ensure they’re not problematic. Experiment with different browsers and devices to confirm functionality. Notify clients of major changes, and remember to involve them in the testing process. Transparency is important. You might otherwise break something for your clients’ end users without them knowing.
Whether you’re a vendor or a website owner, I hope you’ve found these guidelines helpful for creating great user experiences. You can learn more by visiting Google’s portal hosting educational content on this topic or read this free guide containing educational content related to this topic.
Opinions expressed by DZone contributors are their own.