Get More Local Leads with Google Local Services Ads — Plans Start at $600/Month
0 like 0 dislike
422 views
by Marketing Guru (6.6k points)

1 Answer

0 like 0 dislike
by Marketing Guru (6.5k points)

Every day we track data from various platforms like Google Ads, GA4, Meta Pixel, etc, they recommend sending the Transaction ID(order ID) for accurate tracking and reporting, but sometimes the Transaction ID does not appear on the confirmation page, and you can't track it,

In this situation, how we can retrieve it from the confirmation page URL when it's not present or when you're not using the dataLayer?

in this case, we can track the order ID from the URL using Custom JavaScript, (if it's available in your thank you page URL )


Process to implement
1️)Go to your Google Tag Manager
2️)Create page URL Variable (this variable you have to add in the javascript code)
3️)Again create a custom javascript variable and paste this code (add page URL Variable in this code)
function() {
var successful_page_url = {{Page URL}};
var orderID = successful_page_url.split("/")[5];
return orderID;
}
4️)Edit the split number according to your thank you page URL
5️)Click Save
6️)Go to preview and check it
7️)Now you can add this variable to your required event parameters

Join a specialized Q&A site for digital marketing experts focused on ad platforms like Google, Facebook, YouTube, LinkedIn, Bing, Quora, and more. Connect with peers to share strategies on client retention beyond acquisition. Discuss and solve technical, managerial, or general challenges to improve your ad campaigns and client relationships.

Register to unlock your digital marketing potential!
Get More Local Leads!
Google Local Services Ads
Starting at $600/Month

Most popular tags

google-ads facebook-ads meta-ads amazon-fba amazon-ads amazon-seller-help youtube-ads ad-campaigns x-ads amazon-2026 pinterest-ads performance-max paid-advertising glsa amazon-storefront ppc-strategy amazon-ppc amazon-seller-account twitter-ads local-service-ads server-side-tracking tiktok-ads conversion-tracking ppc-marketing google-analytics google-tag-manager server-side-tagging ppc ga4 dv-360 google-business-profile campaign-optimization facebook-pixel white-label-agency dynamic-keyword-insertion tools-to-find-keywords microsoft-advertisement feature-snippet-types meta-threads white-label-advertising convertion-tracking feature-snippet performance-marketing-agency pinterest-conversion-lift-study amazon-ungatedwholesale advantage-plus keyword-research shopify bing-ads-ppc video-ads ad-performance amazon-listing marchupdate2026 ppc-optimization metabusinessmanager landing-page mcc-google youtube-trueview-ads google-ads-calls-from-website-conversion pitch-digital-marketing-services pitch-deck-creation tiktok2026 sales-tax-exemptions audience-targeting ad-optimization ppc-landing-page learning-phase creative-testing google-merchant-listings google-local-service-ads disclosure-rule amazon-fbm ahrefs-keyword-difficulty display-ads demand-gen-campaigns dropshipping clickable-ads gtm amazon-product-listing budget-management creative-optimization looker-studio-report trend-genius-ai pinterest-carousel-ads bing-ads-management ppc-campaigns meta-carousel-ads pmax-campaigns campaign-structure microsoft-ads ad-creatives lead-generation landing-page-optimization advantage-campaigns microsoft-advertising-editor search-ads phased-campaign-strategy digital-marketing-tips digital-advertising negative-keywords
...