Your coupon site receives visitors, yet its dashboard graph stays flat. Adding a different password won’t revive an obsolete analytics connection. A useful Google Analytics 4 setup starts with a current web data stream and ends with verified events: a visitor views an offer, copies a code and chooses an affiliate link.
couponPHP is a self-hosted PHP coupon and deal script with historical dashboard analytics and outgoing-click reporting. Those features are useful context, but the recovered 2016 integration isn’t evidence of GA4 compatibility. Separate the browser’s data collection from any server-side dashboard connector you may need to replace.
Google Analytics 4 setup replaces the old UA workflow
The original guide uses a Tracking ID, View ID and account credentials. GA4 uses a different property model. Standard Universal Analytics properties stopped processing new data on July 1, 2023. Paid Universal Analytics 360 properties received an extension ending July 1, 2024. Wikipedia’s Google Analytics history, accessed in 2026, records the transition [1].
Your Google Analytics 4 setup won’t work by pasting a G- ID into an old form. Inspect active scripts; dashboard reporting needs a separate compatible integration.
Create your property, web stream and tag
Say you run a UK deals site but leave the reporting timezone set to another region. Friday’s late-night clicks can fall into a different reporting day. Select the timezone and currency you plan to use when comparing campaigns, rather than accepting unexplained defaults.
NC State University’s setup guidance, accessed in 2026, describes the account, property and web-stream sequence [2]. For a PHP coupon site:
- In Analytics Admin, create or select the business account. Create a GA4 property, enter its name and set the reporting timezone and currency.
- Complete the business and reporting options. In Data streams, add a Web stream for your primary website and give it a clear name.
- Open the stream details and copy its
G-measurement ID. A numeric property ID and a tag-managerGTM-container ID aren’t substitutes. - Choose one installation method: the Google tag in a shared template, or a tag-manager container with a Google tag. Don’t install both for the same purpose.
- Connect that method to your consent controls before publishing. Open the deployed site and check collection in Realtime, then use DebugView for marked debug traffic.
For manual installation, obtain the complete tag from the web stream’s View tag instructions → Install manually screen. Place it in the site’s shared head template so eligible public pages use the same configuration. Boston University’s guidance, accessed in 2026, explains the G- ID and shared HTML installation approach [3]. With consent gating, the template must arrange loading according to the visitor’s choice rather than firing unconditionally.
Check store pages, coupon popups and the active template, then clear relevant template caches. Exclude admin pages from public measurement if they aren’t part of your reporting plan. Search for duplicate tags introduced by a theme and another plugin.
Measure outbound affiliate clicks without hiding redirects
A link directly to a merchant or network domain can be recorded by enhanced measurement’s outbound-click option. In the web stream settings, enable the outbound-click measurement you need. These interactions use the click event and link-related parameters.
But a coupon site’s button may first point to a route on its own domain, which then redirects to the merchant. That first link isn’t outbound in the browser’s view. Domains included in cross-domain measurement are also excluded from automatic outbound measurement. So a missing automatic click isn’t always a broken tag.
For coupon interactions, use affiliate_click. This example needs the installed Google tag and a consent layer maintaining window.siteAnalyticsConsent. Use controlled, non-personal IDs; the route is illustrative.
<a href="/go/offer-123/" data-affiliate-link
data-store-id="42" data-coupon-id="123">Visit store</a>
<script>
document.addEventListener('click', (event) => {
if (!(event.target instanceof Element)) return;
const link = event.target.closest('a[data-affiliate-link]');
if (!link || window.siteAnalyticsConsent !== 'granted') return;
if (typeof window.gtag !== 'function') return;
window.gtag('event', 'affiliate_click', {
store_id: link.dataset.storeId,
coupon_id: link.dataset.couponId
});
});
</script>
The consent marker isn’t a GA4 setting. Your application must set it when permission is granted and clear it on withdrawal; it defaults to no collection here. This handler records ordinary click activation, not every possible navigation method. It leaves the link usable even if analytics is blocked, and records an attempted interaction rather than proving the redirect completed.
Register needed custom parameters as event-scoped custom dimensions for reporting. If enhanced measurement also records the external link, don’t add both event counts and call the sum “affiliate clicks.” Choose a single business definition. Keep coupon_copy separate, and send it only after your copy implementation reports success.
Consent should govern collection, not just display a banner
A banner can say “optional” while the page loads analytics before anyone chooses. Test network requests and storage before consent, after acceptance, after rejection and after withdrawal. Your business still needs a documented lawful basis for applicable personal-data processing.
The ICO’s storage-and-access guidance, accessed in 2026, includes a conditional UK statistical-purposes exception [4]. It is limited to qualifying aggregate statistics for service improvement, with clear information and a simple free objection mechanism. It doesn’t provide a general exemption for advertising, profiling or retained individual browsing histories. Don’t assume your GA4 configuration qualifies.
Blocking optional tags until agreement is a practical starting position. Consent Mode can communicate choices to tags, but it isn’t permission by itself; advanced implementations may still send cookieless signals. Review those requests before assuming rejection means no transmission.
Avoid names, emails or coupon account identifiers that reveal a person in event parameters. Page URLs and search terms can leak them too. Use only the measurement settings your reporting requires, including a justified retention period.
Validate the report before using it to judge revenue
Duplicate tags inflate counts. Test one page load and affiliate interaction, then inspect events in the intended property. Reports can lag behind debug tools; adding another tag won’t fix that.
Consent and browser blocking can explain differences from outgoing-click records. Neither count proves a sale. Reconcile revenue through your marketing metrics and last-click attribution guide. For dashboard failures, check version compatibility.
The original 2016 Analytics guide
Archive notice: Published on 17 January 2016. These Universal Analytics IDs, view settings and password-based authentication steps are obsolete for GA4. Commercial links are deactivated while their labels remain. Don’t apply the historical authentication workaround as a current security recommendation.
couponPHP is using Google Analytics to provide you with insights of your visitors. Setting up Google Analytics can be bit tricky but you should be able to do it with this step-by-step guide.
- Login to your Google Analytics account
- Click “Admin” in the top menu
- Select the account you would like to use with couponPHP or create a new account.
- In the 2nd column click “Property settings”. It should look something like this:
- Copy the “Tracking ID” and save it in notepad
- Now hit the back button and click “View Settings” in the right-most column. It should look something like this:
- Copy the “View ID”, this will be your profile ID
- Head over to your couponPHP admin area and select Configuration > Manage Accounts > Google Analytics
- Populate the form with the data you gathered. Make sure you use your full email address in the “Username” field
- Your analytics is now set up. You can see your pretty graph in your admin’s dashboard
- I’m getting “Can’t authenticate” errors
Recently Google applied some security measures which prevents the script from logging in to your account when your server is in a different country than yourself. Fortunately there is a workaround:
- Enable 2-step authentication for your Google account: Click here
- Create an “application specific password” for CouponPHP: Click here
- Use this newly created password in your admin area
Frequently asked questions
Can I use my old Universal Analytics tracking ID in GA4?
No. A Universal Analytics UA- tracking ID and a GA4 G- measurement ID identify different collection systems. Create or select a GA4 property and web data stream, then install its tag. Standard Universal Analytics properties stopped processing new data on July 1, 2023; changing an old dashboard password cannot restore that collection.
Does GA4 automatically measure affiliate link clicks?
Enhanced measurement can record clicks on links that lead to another domain. A same-domain coupon redirect may not qualify, and domains configured for cross-domain measurement are excluded. Use a dedicated affiliate_click event for your chosen affiliate interaction when necessary. Validate one test click and avoid combining automatic and custom events into a double-counted total.
Do I need consent before loading Google Analytics?
That depends on applicable law, your configuration and the purposes of collection. A safe starting point is to block optional analytics until the visitor agrees, then respect withdrawal. Don’t assume all analytics qualify for an exemption. Advertising, profiling and retained individual activity can change the answer, so review the implementation rather than the product label.
