Web Development14 min read•

Web Development Company in Pune: How to Build a Cookie Consent Banner That Actually Controls Your Scripts, Not Just Decorates Your Page

How to build a cookie consent banner that blocks analytics and ad scripts until consent: categories, Consent Mode, design rules, a ten-minute test and a handover checklist.

#web development company Pune#cookie consent banner#DPDP Act#Google Consent Mode

Web Development Company in Pune: How to Build a Cookie Consent Banner That Actually Controls Your Scripts, Not Just Decorates Your Page

A cookie consent banner only works if it controls what loads. A bar at the bottom of the page that says "We use cookies" while Google Analytics, a Meta Pixel and a chat widget all fire before the visitor clicks anything is decoration, not consent management. The build requirement is simple to state: non-essential scripts must not run until the visitor agrees, the choice must be remembered, and the visitor must be able to change it later as easily as they made it. This guide is for Indian business owners and marketing managers who have been told "add a cookie banner" and want to know what a competent web development company in Pune should actually build, test and hand over.

We are a web development company, not a law firm. Nothing here is legal advice. India's Digital Personal Data Protection Act, 2023 and the rules made under it set obligations for how businesses collect and use personal data, and the commencement dates for some provisions are phased. Confirm the current position with a qualified lawyer and the official text on the MeitY website before you finalise your policy wording. What follows is the technical side: how to build a banner that does what it claims.

Who needs a consent banner at all?

It depends on what your site does and who visits it. A brochure site with no analytics, no embedded videos and no advertising scripts sets few or no non-essential cookies, and may not need a banner at all, just an honest privacy notice. A site that runs Google Analytics 4, a Meta Pixel, Google Ads remarketing, a live chat widget, embedded YouTube videos or heatmap tools is using third-party scripts that can collect personal data, and you should treat consent seriously.

If you have visitors from the European Union or the United Kingdom, separate rules there (the ePrivacy rules and GDPR, and the UK equivalents) have long required prior consent for non-essential cookies. Many Indian agencies serving overseas clients therefore build banners to that stricter standard. If your audience is purely in India, the DPDP framework is the main reference, and what it requires in practice is clear notice and consent for processing personal data, with a way to withdraw. Our guide to DPDP Act compliance for business websites explains the legal side in plain language; this article covers the engineering.

What a cookie is, and why scripts matter more than cookies

A cookie is a small piece of text a website stores in the visitor's browser. But the more important unit for your build is the script. A script from Google, Meta, LinkedIn or a chat vendor runs in the visitor's browser, may set its own cookies, may read identifiers, and may send data to the vendor's servers. Blocking the cookie after the script has already run does not undo what the script sent. That is why a proper banner is built around blocking scripts until consent, not around deleting cookies afterwards.

The four categories you will usually need

  1. Strictly necessary: needed for the site to function — session handling, cart contents, security tokens, load balancing, the consent choice itself. These do not need consent in most frameworks, but you should still list them honestly.
  2. Preferences: remembering language, region or display choices.
  3. Analytics or statistics: measuring how the site is used, such as GA4 or Microsoft Clarity.
  4. Marketing or advertising: pixels and tags that build audiences or measure ad conversions, such as the Meta Pixel and Google Ads tags.

The banner should let a visitor accept or reject categories 2, 3 and 4 separately, and category 1 should be shown as always on.

How a banner actually works, step by step

Understanding the mechanism helps you test whether your own banner is real.

  1. Page loads. Only strictly necessary code runs. Analytics and marketing tags are present in the page but held back, or loaded by a tag manager that waits for a signal.
  2. Banner appears. It explains the purpose in plain language and offers choices.
  3. The visitor chooses. The choice is stored, usually in a first-party cookie or in local storage, with a timestamp and a version number of the policy.
  4. Scripts are released or stay blocked. If analytics is accepted, the analytics tag now loads. If rejected, it never loads.
  5. The choice is respected on every later page and visit until it expires or the visitor changes it.
  6. A permanent link, such as "Cookie settings" in the footer, reopens the choices so the visitor can withdraw consent.

If your banner skips step 4, the build has failed the main requirement, however good the design looks.

Consent Mode and tag managers

Google provides a feature called Consent Mode that lets Google tags adjust their behaviour according to the visitor's consent signals. With it, tags can be configured so that, when analytics or advertising consent is denied, they do not set the usual cookies and send limited, cookieless signals instead, depending on how Consent Mode is configured. Google's documentation describes the parameters and the default and update commands. If you use Google Tag Manager, the consent settings for each tag decide whether it waits for consent. Setting this up correctly is the part most often done wrongly, because the default state must be set before any Google tag fires, not after. Our guide on Google Ads enhanced conversions and consent mode covers the advertising side in detail.

Design rules that keep a banner honest

Technical blocking is half the job. The other half is that the choices presented are fair. Regulators in several countries have objected to banners that make accepting easy and rejecting hard. Whatever law applies to you, a banner that tricks visitors into agreement is a trust problem and a risk.

Equal prominence for accept and reject

If "Accept all" is a bright button and "Reject" is a faint text link three clicks deep, the design is steering the visitor. Give "Accept all" and "Reject non-essential" equal visual weight on the first layer. Our piece on dark patterns in checkout and consent flows explains why this matters for trust and for compliance.

Plain language, specific purposes

"We use cookies to improve your experience" tells the visitor nothing. Say what each category does: "Analytics: counts visits so we can see which pages help. Marketing: lets us measure our advertisements on Google and Meta." Name the vendors in a list inside the settings panel.

No pre-ticked boxes

Optional categories should start off. A visitor who has to opt in has actually opted in.

Language

For visitors in Maharashtra, offer the banner in Marathi and Hindi as well as English if your site is multilingual. DPDP-related materials from the government emphasise that notices should be understandable; if your site serves Marathi readers, give them a notice they can read. See our guide to multilingual site builds for practicalities.

Mobile behaviour

A banner that fills the whole mobile screen and cannot be dismissed without choosing can harm the user experience and your search performance. Google's guidance on intrusive interstitials says that notices required by law, such as cookie notices, are not a problem in themselves, but large overlays that hide the content on mobile hurt usability. A compact bottom sheet with clear choices is a safer pattern. Our article on popups, exit offers and cookie banners on mobile goes through the layout trade-offs.

Build options compared

Option What you get Watch out for
Consent management plugin for WordPress Quick setup, category blocking for common plugins, a cookie scanner Plugin may not block hard-coded scripts in your theme; free tiers may limit features
Hosted consent management platform (paid SaaS) Scanning, consent logs, multilingual banners, Google Consent Mode integration Monthly fee that grows with traffic; vendor script itself adds weight; check data location terms
Open-source library built into a custom site Full control, no monthly fee, no third-party script Needs a developer to implement blocking, storage and the preferences link properly
Banner with no blocking (cosmetic) Looks compliant Does not control scripts, so offers no real protection and may mislead visitors

Prices for hosted platforms change often and depend on page views, so we do not quote figures here. TODO for the business owner: get current price quotes from at least two vendors against your own monthly traffic before deciding.

What to ask a developer or vendor

  • Which of my scripts will be blocked before consent, and how do you prove it?
  • Where is the consent record stored, and can I export it?
  • Does the "Cookie settings" link reopen the banner at any time?
  • How does it behave on a slow mobile connection? Does the banner delay the largest content paint?
  • What happens when I add a new tracking script in future? Who updates the blocking rules?

A test you can run yourself in ten minutes

You do not need to be technical to check whether a banner really works. Use a desktop browser such as Chrome.

  1. Open a private (incognito) window so that no earlier choices are stored.
  2. Open the developer tools (press F12), go to the Network tab and tick "Preserve log".
  3. Load your site. Do not click the banner.
  4. In the network filter box type the vendors you use, for example google-analytics, googletagmanager, facebook, clarity. If you see requests going to analytics or advertising domains before you click anything, scripts are not being blocked.
  5. Click "Reject non-essential". Reload. Check again. There should be no requests to the blocked vendors.
  6. Click "Accept" in a fresh window. Now the requests should appear.
  7. Open the Application tab, look under Cookies, and compare the cookies set after rejection with those set after acceptance.

If the requests appear before you choose, your banner is cosmetic. This test takes minutes and is the single most useful check you can do before paying for a build or for a monthly platform.

Performance and the banner itself

A consent platform adds its own script and often its own styles. Poorly built, it can delay rendering. Practical measures:

  • Load the banner script early but asynchronously, and keep its markup small.
  • Avoid layout shift: reserve space or position the banner so that it overlays without pushing content down after the page has painted. Layout shift counts against the Cumulative Layout Shift metric.
  • Do not let the banner block the main content from rendering.
  • Test with PageSpeed Insights before and after adding it, using the same page and device settings. Record the change; do not assume it is zero.

See our guide to Core Web Vitals for online stores for how to read the scores honestly.

Records, expiry and changes

Keep a consent record

For accountability, store at least the choice, the date and time, and the version of the banner text. Many platforms keep this for you. If you build your own, store it server-side where possible, with minimal identifiers, and be careful that the record itself does not become another unnecessary pile of personal data. Do not keep it longer than you need.

Choose a sensible expiry

Many sites ask again after six to twelve months. There is no single correct period in Indian rules that we can cite here; TODO: confirm with your legal adviser. Ask again sooner if you add a new category of tracking, or change your vendors materially.

Respect withdrawal

If a visitor withdraws consent, stop the relevant scripts on the next page load and, where the vendor offers it, delete previously collected data on request. A footer link that reopens the settings is essential.

Special cases for Indian businesses

Lead forms and enquiry data

A cookie banner is not the same thing as consent for processing form data. When a visitor submits an enquiry form, you need a clear purpose statement near the form and a way to handle later deletion or correction requests. Do not rely on the cookie banner to cover it. Our guide on connecting website forms to a CRM shows how to store the consent text with each lead.

Embedded video and maps

A YouTube embed or a Google Maps iframe can set cookies and send data as soon as it loads. A privacy-friendly pattern is a click-to-load placeholder: show a thumbnail and a line of text, and load the real embed only after the visitor clicks. This also helps page speed, as covered in our article on embedding YouTube and Google Maps without slowing the site.

WhatsApp buttons

A simple link to wa.me sets no tracking cookie by itself, but the page it leads to is WhatsApp's, under their terms. If you track clicks on the button through analytics, that tracking falls under your analytics consent.

Children's data

If your site is aimed at children, for example a coaching class for school students, the DPDP framework treats children's data with special care, including a requirement for verifiable parental consent for processing a child's personal data. TODO: confirm the exact current rules with a lawyer before collecting any data from under-18 users.

NGOs and donors

NGO donation sites often combine analytics, remarketing and payment scripts. Payment pages should keep third-party scripts to a minimum, and donor identifiers should never be passed to advertising platforms without explicit consent. See how to build NGO sites that treat donor data carefully.

Common mistakes we see

  1. The cosmetic banner. It displays a message but does not block anything.
  2. Scripts hard-coded in the theme. The plugin blocks what it knows about; a snippet pasted into the header file runs regardless.
  3. Tag Manager fires everything on page view. The consent defaults are never set.
  4. Reject buried. The first layer offers only "Accept" and "Manage".
  5. No way back. The visitor cannot withdraw.
  6. Never audited after launch. A marketer adds a new pixel six months later and bypasses the banner.
  7. Copying another company's policy text. The list of vendors in your policy must match what your site actually loads.

Handover checklist

  • A list of every script and cookie the site uses, with its purpose and category.
  • Documentation of how each non-essential script is blocked.
  • The test above, run and recorded with screenshots.
  • A footer "Cookie settings" link that works on every page and in every language.
  • A named person responsible for updating the list when marketing adds tools.
  • A review date, put in a calendar, within twelve months.

Frequently Asked Questions

Do I need a cookie banner if I only use Google Analytics?

Google Analytics sets cookies and collects data about visitors, so most privacy frameworks treat it as non-essential and expect notice and a choice. What you must do in India depends on how the DPDP rules apply to you; confirm with a legal adviser. Technically, make sure the tag does not fire before the visitor chooses.

Is a "We use cookies, click OK" bar enough?

Not if scripts load before the click, or if there is no way to reject. A bar is only useful when it blocks non-essential scripts until consent and lets visitors change their mind later.

Will a cookie banner hurt my SEO?

A poorly built one can, by causing layout shift or covering content on mobile. A compact, well-placed banner that loads asynchronously has little effect. Test before and after with PageSpeed Insights.

What is Google Consent Mode?

It is a Google feature that lets Google tags and Tag Manager adjust their behaviour according to the visitor's consent choices, so that tags do not set analytics or advertising cookies without permission. It must be configured so that the default consent state is set before any Google tag fires.

How often should I ask for consent again?

There is no single answer we can cite for India. Many sites re-ask every six to twelve months or whenever they add new tracking. Confirm your policy with your adviser and record the date in your consent log.

Where to Start

List every script your site loads, using the ten-minute network test above. Sort them into the four categories. If any non-essential script loads before consent, ask your developer to fix the blocking first and to choose the banner tool second. A good banner is a few days of careful work, not a plugin you install and forget.

Govindani Infotech is a web development company in Pune, at Landmark Plaza, Satara Road, Parvati Paytha. We build business websites with consent-aware tracking and can connect enquiry data to a CRM with the consent text stored beside each lead. To review your own site, contact us or call 092019 58274.

Sources:

Need Help With Your Digital Strategy?

Govindani Infotech helps Indian businesses and NGOs build websites, run ads, and grow online. Contact us for a free consultation.