1

I'm tyring to track sign ups as goals, however I have 3 different types of accounts to track so just using the 'registered.html' page as a goal isn't going to do. So therefore I need to use events, why GA requires you to do this is absolutely beyond me. The goal feature is so weak....

Anyway, I'm trying to track events and absolutely nothing I'm doing seems to be working.

I've tried loading it onto a transparent pixel as follows:

<img src="{{ url('img/1x1.png') }}" onload="_gaq.push(['_trackEvent', 'Sign Up', 'Designer Sign Up', '',, false]);" />

That doesn't work. And I've also tried putting the push event in

$(document).ready(function(){

});

to no avail.

If anyone could help me set up this simplest of tracking features I'd be so appreciative.

1 Answer 1

0

There are a couple ways you can do this...with and without events...

1) One route you can take is changing the tracking code on registered.html to send a different URL into GA. I'm not sure your code setup or if you have the ability to alter tracking code page-by-page. How this works is you have an if/else check, as in "if account type is x, show y alteration to the GA tracking script". For each account type you assign a different URL using GA's "set":

ga('set', 'page', '/registered-whateveraccounttype.html');

The "set" code needs to fire after "create" and before "send", which is why you need to alter the code page-by-page. You would then set /registered-whateveraccounttype.html (or whatever the virtual URL is) as your goal page.

2) Going the event route, you'd want to send the GA event on form submit. The easiest way to do this is going to put the event tracking on form submit. You could then get the account type field and pass it along with the event. Using jQuery that could look something like this:

$( "#signup_form" ).submit(function( event ) {  
  var accountType = $( "select.accounttype" ).val();    
  ga('send', 'event', 'form', 'signup',accountType);
});

You can then setup the event as a goal (http://www.blastam.com/blog/index.php/2011/03/how-to-use-events-goals-google-analytics and http://www.lunametrics.com/blog/2011/04/12/events-goals-google-analytics/ are good resources for this).

3
  • So the actual page URL doesn't have to be different, all account sign ups can use registered.html I just "force" a URL in the tracking code?
    – Jay Pardoe
    Commented Mar 15, 2016 at 14:11
  • You got it. You can force the URL to be something unique in the tracking code even if it isn't really a unique URL. That way GA never knows about registered.html, they just know the three forced URLs that you pass in the code. Commented Mar 15, 2016 at 14:18
  • Ah ok. Problem solved then! I didn't really want to actually send users to different pages hence why I was looking at events but this works I guess.
    – Jay Pardoe
    Commented Mar 15, 2016 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.