Track Advanced Billing Pages in Google Analytics
Applies to: Advanced Billing
Last updated on Nov 4, 2026
Advanced Billing hosts some of the pages your customers pass through on their way to buying from you, so a complete picture of your funnel means tracking those pages alongside your own site. What follows is where your tracking code runs, the transaction values the receipt page publishes, the parameters a redirect can carry, and the URL patterns your analytics tool needs to recognize.
This integration is yours to maintain. Maxio provides the place to put your tracking code and the page structure it runs against, but the Google Analytics configuration, and keeping it working, are your responsibility.
The Google Analytics side, meaning creating a property, defining conversion events, and building funnel reports, is Google's product and changes on Google's schedule. Follow Google's own setup documentation for that.
Prerequisites
- A Google Analytics account and property of your own.
- The permission in Advanced Billing described as manages product catalog, settings, and integrations, to edit the custom JavaScript on your Public Signup Pages.
- The Custom JavaScript fields in Public Page Default Settings. They're available on paid accounts; if you don't see them, contact Maxio Support.
Where your tracking code runs
Add your tracking code to the site-wide custom JavaScript in Public Page Default Settings. There is one field per Public Signup Page layout, Custom JavaScript - Modern (v2) and Custom JavaScript - Classic (v1). Use the one that matches your pages, or both if you have pages in each layout. Advanced Billing injects the script into two hosted pages:
- The Public Signup Page
- The receipt, or success, page
Expect pageviews from both. Beyond those two pages, the layouts differ: the Classic script also runs on Self-Service Pages, and the Modern script never does.
Important: The receipt page only ever runs the site-wide script. A Public Signup Page with its own custom JavaScript runs that instead of the site-wide script on the signup page, but its receipt page still runs the site-wide one. If you give a page its own custom JavaScript, copy your tracking code into it as well, and keep any receipt-page code in the site-wide field.
Note: Your tracking code reports the full address of each page it runs on. If you pre-fill a Public Signup Page through URL parameters, values such as an email address are part of that address and reach your analytics tool. To keep them out of it, have your site send the same parameters as a form
POSTto the page's URL with/newadded to the end, for examplehttps://acme.chargifypay.com/subscribe/abc123/basic-plan/new.
Important: The pay-invoice page and the bank account verification page both carry the
public-signup-pagemarker used below, but neither one actually receives your custom JavaScript. If you're checking for that marker to decide where your code should run, don't expect it to fire on those two pages, even though the marker matches.
On Modern pages, wrap your tracking code in a check for that marker. Both pages the Modern script runs on carry the marker, so the check is a safeguard rather than a filter: if the code is ever copied into the Classic field, which also runs on Self-Service Pages, it stays inactive there instead of reporting from pages you didn't intend:
if ($('.public-signup-page').length !== 0) {
// Your analytics tracking code goes here.
}jQuery is available on these pages, which is what makes the check above work. A narrower check for the receipt page alone is $('.public-signup-page__success').length === 1. Use it to confine a transaction call to the receipt page, so a completed signup isn't reported again on the Public Signup Page the outer wrapper also covers.
Classic pages don't carry the public-signup-page marker, so code inside the check above never runs on them. On Classic pages, check $('#self-service-page').length === 0 to cover the Public Signup Page and receipt page while skipping Self-Service Pages, and $('#hosted-payment-history').length !== 0 for the receipt page alone. See Scope Custom JavaScript to a Specific Page for the full set of checks.
Important: Don't include
<script>tags. Analytics vendors, Google included, hand you a tag to paste into a page's HTML, so the snippet you're given is wrapped in<script>and</script>. This field takes JavaScript rather than HTML, and Advanced Billing adds the<script>tag on your behalf. Paste only what sits between the tags, or the code is invalid and never runs. See the Custom JavaScript and CSS for Modern Public Signup Pages help article.
Three things worth knowing when you place the code:
- Strip the
<script>tags from whatever your analytics vendor gives you, as above. If a tag loads a library throughsrc, load that library from JavaScript instead, as described in Load your analytics library from JavaScript. - Put it at the very bottom of the custom JavaScript. If anything is wrong with it, it won't disable the other JavaScript above it.
- Remove any similar tracking code already present, so the page doesn't report the same event twice.
If no data reaches your analytics tool at all, check for two things: leftover <script> tags, and a library whose <script src> tag was stripped rather than loaded from JavaScript.
Load your analytics library from JavaScript
Many vendor snippets load their library with a <script> tag that has a src address and nothing between its tags. The Google tag for GA4 is one of them: its first tag loads gtag.js from www.googletagmanager.com. Stripping that tag removes the library, so the rest of the snippet runs but nothing reaches your analytics tool. Load the library from JavaScript instead.
For GA4, replace G-XXXXXXXXXX with your measurement ID:
if ($('.public-signup-page').length !== 0) {
var measurementId = 'G-XXXXXXXXXX';
var googleTag = document.createElement('script');
googleTag.async = true;
googleTag.src = 'https://www.googletagmanager.com/gtag/js?id=' + measurementId;
document.head.appendChild(googleTag);
window.dataLayer = window.dataLayer || [];
window.gtag = function () { window.dataLayer.push(arguments); };
window.gtag('js', new Date());
window.gtag('config', measurementId);
}On Classic pages, swap the outer check for the Classic one in Where your tracking code runs. Other vendors follow the same pattern: create the <script> element, set its src, and run the vendor's inline code after it. Google Tag Manager's main snippet already loads its library this way, so it works with its <script> tags stripped. Leave out its <noscript> part, which is HTML.
Values published on the receipt page
When a signup completes, Advanced Billing writes the transaction details into hidden elements on the receipt page, and injects your custom JavaScript immediately after them. Your code can read the values directly rather than passing them through the URL.
Values Advanced Billing publishes on the receipt page
| Element ID | Contains |
|---|---|
analytics-signup-payment-id | The ID of the signup payment |
analytics-signup-revenue | The signup revenue |
analytics-currency | The subscription's currency |
analytics-product-id | The product ID |
analytics-product-handle | The product handle |
analytics-signup-created-at | The subscription's creation time, as a Unix timestamp |
Read one with an ordinary selector, for example $('#analytics-signup-revenue').html().
For a signup with nothing charged, such as a free trial, analytics-signup-revenue is zero and analytics-signup-payment-id doesn't identify a payment: it holds the ID of an authorization or another transaction, or 0. Don't report it as a transaction ID for those signups.
For example, this reports a paid signup to GA4 as a purchase event. Put it inside the outer check from Load your analytics library from JavaScript, after the config line:
if ($('.public-signup-page__success').length === 1) {
var revenue = parseFloat($('#analytics-signup-revenue').text());
if (revenue > 0) {
window.gtag('event', 'purchase', {
transaction_id: $('#analytics-signup-payment-id').text().trim(),
value: revenue,
currency: $('#analytics-currency').text().trim(),
items: [{ item_id: $('#analytics-product-handle').text().trim() }]
});
}
}On a Classic receipt page, use $('#hosted-payment-history').length !== 0 as the receipt check.
Send customers to your own thank-you page
If you'd rather finish the journey on your own site, Advanced Billing redirects the customer after a successful signup and appends the transaction details to the redirect URL as query parameters. Your thank-you page reads them back out, and your tracking code goes on that page instead of in the custom JavaScript.
To configure the redirect
-
Edit the Public Signup Page you want to redirect from. See the Public Signup Page Settings Reference help article.
-
Enter the full thank-you page URL under Return URL after successful signup, for example
http://www.mywebsite.com/my-thank-you-page.html. -
Enter the parameters you want under Return Parameters, each placeholder wrapped in braces. For example:
transaction_id={signup_payment_id}&revenue={signup_revenue}&name={product_handle}&sku={product_id} -
Save your changes, and repeat for each Public Signup Page that should redirect.
Important: Leaving Return URL after successful signup blank sends customers to Advanced Billing's own receipt page instead. In that case the values in Values published on the receipt page apply, and no return parameters are involved.
Seven placeholders are available:
Return Parameter placeholders
| Placeholder | Contains |
|---|---|
{signup_payment_id} | The ID of the signup payment |
{signup_revenue} | The signup revenue |
{product_handle} | The product handle |
{product_id} | The product ID |
{subscription_id} | The subscription ID |
{customer_id} | The customer ID |
{customer_reference} | Your own reference for the customer |
URL patterns for conversion tracking
Whatever analytics tool you use, it needs to recognize Advanced Billing's pages by URL to count a signup as a conversion or place it in a funnel. Two patterns matter:
Advanced Billing URL patterns
| Page | Pattern |
|---|---|
| Public Signup Page | /subscribe/ |
| Receipt page | .*\/subscribe\/.*\/show |
The receipt page is the one that marks a completed signup, so it's the conversion. The Public Signup Page is the step before it.
If your analytics tool matches on a path rather than a full URL, exclude your own domain from the pattern and match a unique part of the path. For a "buy now" page at www.mywebsite.com/home.html, that's /home.html.
Link tracking across domains
Your Public Signup Pages are served from chargifypay.com, not from your own domain. To an analytics tool, a customer who moves from your site to a Public Signup Page and on to the receipt page is two unrelated visitors on two unrelated sites, and the revenue is credited to neither.
Fixing this is cross-domain tracking, and it needs configuring on the Google side rather than in Advanced Billing. What Advanced Billing determines is the domain you have to name: check the domain your own Public Signup Pages actually serve from and use that, since a custom domain changes it.
For how to set it up, see Google's cross-domain measurement documentation.
For reporting transactions and revenue, see Google's documentation on measuring ecommerce.
Still need help?
Reach out and our support team will take it from here.
