Setting Up a GA Conversion Goal
All Straightsell websites do not have separate pages for each page of the checkout process, they only have one page called “payments/pages/purchase_pages.php” – a bit of an issue when trying to track page loads…
As a result, we have implemented “virtual pageviews” for the checkout process, which is commonly used for when a customer wants to do Conversion Tracking in Google Analytics.
The virtual pageviews code tells Google Analytics or any other tracking what page the checkout process is up to; the names of each virtual pageview are:
UA:
ga('send', 'pageview', 'payments/pages/contact.php');
ga('send', 'pageview', 'payments/pages/freight.php');
ga('send', 'pageview', 'payments/pages/confirm.php'); OR ga('send', 'pageview', 'payments/pages/confirm_creditcard.php');
ga('send', 'pageview', 'payments/pages/complete.php'); OR ga('send', 'pageview', 'payments/pages/complete_creditcard.php');
So:
/payments/pages/complete.php – Is the final URL for completed purchases using other payment methods (Direct Deposit, Credit Card by Phone, and On Account).
/payments/pages/complete_creditcard.php – The final URL for completed purchases using credit card only.
GA4:
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/contact.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/freight.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/confirm.php'}); OR gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/confirm_creditcard.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/complete.php'}); OR gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/complete_creditcard.php'});
So:
payments/pages/confirm.php – Is the page shown when the website user has chosen to complete purchases using other payment methods (Direct Deposit, Credit Card by Phone, and On Account).
payments/pages/confirm_creditcard.php – Is the page shown when the website user has chosen credit card only.
GA4 with Single Page Checkout:
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/contact.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/freight.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/terms.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/confirm.php'}); OR gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/confirm_creditcard.php'});
gtag('config', '{$AnalyticsAccountCode}', {'page_path': 'payments/pages/complete.php'});
So:
payments/pages/confirm.php – Is the page shown when the website user has chosen to complete purchases using other payment methods (Direct Deposit, Credit Card by Phone, and On Account).
payments/pages/confirm_creditcard.php – Is the page shown when the website user has chosen credit card only.
NOTE: Google Analytics needs to be enabled in the Global Parameters of your website in order for either the UA or GA4 code to be included in page source generated on your website.