Track Conversions When Your URL Does Not Change
If you perform Internet marketing functions for enough clients, youâre bound to run across this problem at one point or another.
Below are several ways to track these conversions along with examples.
1. Analytics Event Tracking
Event Tracking is a fairly powerful and very underutilized function in Google Analytics that allows you to track things like button clicks, video plays, or file downloads. Â Event tracking makes a call to ga.js in order to notate non-pageview items on your website. Â The results will show up in the âEventsâ reports under the âContentâ section of Google Analytics. Â You can also define an event as a goal. Â For our purposes, we want to track people who press the âSubmitâ button on the lead form.
In this example, we only need to focus on the âSubmitâ button in the code. Â Below is a generic example of such a button.
<input type=âbuttonâ id=âsubbtnâ value=âSubmit;â />
To add event tracking to this button, weâll need a minimum of 3 basic elements:
the _trackEvent function
An event category (a grouping that you determine for the event, i.e. âlead formsâ)
An event action (what the user is doing to trigger the event, i.e. âsubmitâ)
Labels (additional information you want to provide about the event) and values (similar to a goal value) can also be added but are not required. Â Weâll omit them for simplicity.
After adding that information, here is how our new code should look:
<input type=âbuttonâ id=âsubbtnâ value=âSubmitâ onClick=â_gaq.push([â_trackEventâ, âFormsâ, âSubmitâ]);â />
Please note that this is not a perfect solution. Â If a user clicks the âSubmitâ button more than once, the event may be duplicated. Â Also, if somebody does not fill out the form in its entirety and receives an error upon submitting, it will still track as an event even if they do not go back and complete the form. Â If you have some sort of form validation in place, you can modify the code to only run if the submission was successful but that will vary by the type of form youâre using.
2. Analytics On-Click Virtual Pageviews
The _trackPageview function is another call to ga.js that allows you to artificially generate a pageview when an actual pageview does not take place. Â This is quite useful for many of the same reasons as Event Tracking, and has the added benefit of showing up as a pageview in your content reports. Â For example, if you have an AJAX shopping cart, you can use this function to tell which step of the checkout a user abandons. Â This is also common if you have PDFs on your site for sales info, forms, restaurant menus, etc. Virtual pageviews can also be turned into goals, just like a standard pageview goal.
For this tracking function, letâs assume your checkout is all on one page but requires users to click âcontinueâ to reach separate sections. Â Below is the existing code example:
<button type=âbuttonâ id=âcontinueCheckoutâ onclick=âbilling.save()â></button>
(user clicks that button, and then, the following div loads)
<div id=âcheckout-step-paymentâ>
With virtual pageviews, we only need to create the call to _trackPageview and provide the naming convention for the virtual URL. Â There are numerous ways to call these actions but weâll use an onclick event to do so here. Â Below is the modified example:
<button type=âbuttonâ id=âcontinueCheckoutâ onclick=âbilling.save(); javascript: _gaq.push([â_trackPageviewâ, â/checkout/paymentâ]);â></button>
In this example, the semi-colon at the end of the existing onclick event is important so the browser knows to look for additional items when the button is clicked.
3. Conversion Code in a div that Loads after Submission.
In many forms, the user is greeted with a âthank youâ message that appears on the page upon hitting submit but the URL does not change. Â Generally, this type of response is called by PHP and the specifics of it can vary by the type of form youâre using. Â However, if your site is developed in PHP, thereâs a good chance your form page will have a section like the one below:
<?php if ( $success ) echo â<p>Thanks for sending your message! Weâll get back to you shortly.</p>â ?>
This is your opportunity to add your AdWords / AdCenter tracking code. Â Simply paste the code you get from the PPC channel into the response message and it will appear after a user successfully submits your form. Â Even though this is pretty straightforward, I have an example below (please substitute with your own PPC conversion code or this wonât work).
<?php if ( $success ) echo â<p>Thanks for sending your message! Weâll get back to you shortly. <!â Google Code for Conversion Page â> <script type=âtext/javascriptâ> /* <![CDATA[ */ var google_conversion_id = xxxxxxxxxx; var google_conversion_language = âenâ; var google_conversion_format = â2â; var google_conversion_color = âffffffâ; var google_conversion_label = âxxxxxxxxxxâ; var google_conversion_value = 0; /* ]]> */ </script> <script type=âtext/javascriptâ src=âhttp://www.googleadservices.com/pagead/conversion.jsâ> </script> <noscript> <div style=âdisplay:inline;â> <img height=â1âł width=â1âł style=âborder-style:none;â alt=ââ src=âhttp://www.googleadservices.com/pagead/conversion/xxxxxxxxxx/?label=xxxxxxxxxx&guid=ON&script=0âł/> </div> </noscript> </p>â ?>
4. On-Click Conversions with Call Tracking
This fairly new feature of AdWords allows you to track click-to-call actions on your website as conversions. Â This is great for mobile traffic or desktop users that have Skype (or a similar VOIP solution) installed. Â When you create a new conversion in AdWords, youâll now see a new option.
The conversion code is below, and has a few key differences from a standard conversion.
<!â Google Code for Phone Call Conversion Page In your html page, add the snippet and call goog_report_conversion when someone clicks on the phone number link or button. â> <script type=âtext/javascriptâ> /* <![CDATA[ */ goog_snippet_vars = function() { var w = window; w.google_conversion_id = xxxxxxxxxx; w.google_conversion_label = âxxxxxxxxxxâ; w.google_conversion_value = 0; } // DO NOT CHANGE THE CODE BELOW. goog_report_conversion = function(url) { goog_snippet_vars(); window.google_conversion_format = â3â; window.google_is_call = true; var opt = new Object(); opt.onload_callback = function() { if (typeof(url) != âundefinedâ) { window.location = url; } } var conv_handler = window[âgoogle_trackConversionâ]; if (typeof(conv_handler) == âfunctionâ) { conv_handler(opt); } } /* ]]> */ </script> <script type=âtext/javascriptâ src=âhttp://www.googleadservices.com/pagead/conversion_async.jsâ> </script>
For one, itâs all javascript. Â Due to the nature of this conversion type, there is no way a script-free pixel can fire so users must have javascript enabled.
Beyond that, you need to have some extra code to make this conversion type work. Â The code above goes on any page with your phone number listed. Â To activate the conversion (and initiate the phone call), you need some extra code. Â Below is the most common example, a text phone number:
<button onclick=âgoog_report_conversion(âtel:555-555-5555â˛)â>Call 555-555-5555</button>
The action in the âonclickâ section tells the conversion script to run and for your phone to start dialing. Â Itâs quite simple to implement and very valuable for companies that receive a lot of phone leads.














