How to Load Non-Minified Google Publisher Tag (GPT) Scripts on Production

Introduction

For troubleshooting and optimizing ad setups, non-minified GPT scripts are easier to debug. Requestly lets you load these non-minified scripts in production without altering your site’s core code. This post explains how to configure Requestly for this task.

Why Use Requestly?

Requestly lets you modify, redirect, and insert scripts into HTTP requests and responses. It helps with testing and debugging by allowing you to load non-minified GPT scripts in production, optimizing performance without disrupting the live site.

Setting Up Non-Minified GPT Script Loading with Requestly

1. Install Requestly

Begin by installing the Requestly extension from the Chrome Web Store or Requestly’s official website.

2. Set Up a Redirect Rule

The Redirect Rule in Requestly allows you to redirect requests for minified scripts to their non-minified counterparts. This is particularly useful for loading readable, non-minified GPT scripts in your production environment for debugging and optimization.

Here’s how to set up a redirect rule for GPT scripts:

  1. Open Requestly: Click on the Requestly icon in your browser.
  2. Create a New Rule: Click on ‘New Rule’ and select ‘Redirect Rule.’
  3. Enter the Minified Production URL Pattern: Add the URL pattern for the minified GPT scripts used in your production environment. This tells Requestly which requests to redirect.
  4. Specify the Non-Minified URL: Enter the URL for the non-minified version of the GPT scripts. This URL will be the target of the redirect.
    • Example Minified URL: https://example.com/gpt.min.js
    • Example Non-Minified URL: https://example.com/gpt.js
  5. Save the Rule: Click ‘Save’ to create the rule and ensure the rule is activated by toggling the switch to the ‘On’ position.

Conclusion

Using Requestly to load non-minified GPT scripts on production is a great way to gain insights into your ad code and troubleshoot issues more effectively. This approach allows you to work with readable, debuggable code in a live environment, making it easier to identify and resolve problems.

Explore More:

Share this article:

Subscribe to our weekly newsletter !

Join 10k developers and QAs to get weekly updates with Requestly's newsletter.​

This article was written by:

Picture of Kanishk Rawat

Kanishk Rawat

Kanishk Rawat, a tech enthusiast since childhood, has mastered programming through dedication. Whether solo or in a team, he thrives on challenges, crafting innovative solutions .

Join 10k developers and get weekly updates with Requestly's newsletter.

Contents