I recently transitioned my company's websites to Google Tag Manager. Due to the fact that our contact forms don't have unique confirmation pages with unique URLs, we use virtual pageviews to track conversions. The form is submitted, and the page reloads with new content and our conversion tracking codes.
Since migrating to GTM, all of our virtual pageviews stopped working. Now when I submit a form on our site, I get this in the console log:
ReferenceError: ga is not defined
ga('send', 'pageview', '/funnel_G1/premium1.html');
Before, we had Universal Analytics loading directly on the page. Now we are loading Universal Analytics through GTM. That is all that has changed and I can't figure out why our virtual pageview scripts no longer work.
This is script that fires on a form completion:
<script type="text/javascript">
$(document).ready(function () {
ga('send', 'pageview', '/funnel_G1/premium1.html');
});
</script>