Google analytics goal complete when lead capture?


#1

is there a way to set up a goal in google analytics and trigger it when a form is filled out on an unbounce landing page?


#2

hi Carter,
thanks - will check this out and see if I can get it working!
bert


#3

hi carter,
isn’t it a problem that with the solution you’re suggesting, i include the GA tracker code twice?
one time in the landing page and another time in the “popup page”?
Bert


#4

Hi Bert,
It probably seems a bit confusing having to do it this way, but think about both the main page and the “popup” as two different Unbounce pages – both executing their own set of javascript. You want Google Analytics to know when a visitor comes to your main page, but you also want to track when they see the “popup”. The popup page is actually an iframe, so its scripts will execute in a separate scope than the main page.

Hopefully that’s not too confusing. One day we’ll have proper Google Analytics integration so you can just give us your ID and we’ll take care of the rest…

If you’re still having some trouble, just fire an email to support@unbounce.com with the page in question (mention it’s for Carter to look at) and I’ll take a look.

Cheers,
Carter


#5

hi Carter
I remember reading somewhere that google analytics in an iframe might not work - have you tried it yet?
thanks
B


#6

Hey Bert,
I have not tried the solution that I mentioned above, but I can’t see why google wouldn’t accept a page in an iframe. The issue you may have read about is when you have an iframe with a page on a different domain – the tracking is cookie based so the domains need to match (which they do in our case).

I have set things up for a test page of ours and will let you know the outcome. Have you tried setting things up yet?

Cheers


#7

hi Carter
not yet- I’ve been busy all day putting tracking code into our pages.
i hope to play with it a bit tonight and then wait until tomorrow to get some data. how long should I wait- 24h?
b


#8

Things should be fairly real-time with Google Analytics, but you’ll have to make sure to set the date range to include today (it defaults to yesterday being the end of the date range). I also dug up this documentation on the iframe/external domains issue. Is that what you read?


#9

date range- that is something I choose when I go look at the data right? It’s not actually something i have to set at the time of analytics config …
i think that’s the link I found wrt. iframes.


#10

Yup date range is in Google Analytics when you’re looking at the data (top right):


#11

thanks- let’s cross fingers and hope all the JS stuff I added today works to generate the virtual pageviews, etc


#12

hi carter
data is not showing up here yet in my GA - I’ll send a note to support@unbounce.com under your attention so you can have a quick look at my pages and javascript?
thanks!
b


#13

Hi All,
Good timing on this discussion - I needed to do this just today!

I’ve set it all up as directed, and I’m seeing both my landing page and my /formsubmit page show up in my Google Analytics tracking, but for some reason the /formsubmit is not triggering a Goal Conversion in GA. Would you say that is a question for Google, not for UnBounce?


#14

did you wait 24h? it might take a while for GA to capture the data.
did you set up your goal as described above? you might want to use a regex match instead of head match, like .*formsubmit.*


#15

I had this question too and followed Carter’s tips and GA is successfully tracking the goal. Thanks!


#16

Great to hear guys, happy to hear it’s working out!


#17

Yep, you were right, I just didn’t wait long enough - all is well now, I’m seeing conversions in GA, and I’m happy! Well, mostly happy - it’d be nice if UnBounce made this all easier to set-up - which I think is on your To Do list : )


#18

Yes it certainly is! Great to get an idea of how extensively everyone wants to use GA first so we can build the integration accordingly.


#19

one thing i’m still unclear about is whether it should trigger as a virtual pageview or as an event in GA …


#20

Virtual Pageview is what you want - the reason is that Google Analytics does not (currently) allow you to use Events to indicate Goal completions. It seems likely that they will allow this someday, as supporting only virtual pageviews causes distortions in statistics like Pages/Visit, but for now you must use Virtual Pageviews to trigger Goal completions.