Unbounce Answers/Next Steps/Analytics, Stats & Conversions

How do I add Google Analytics to my landing page? [VIDEO]

Oli Gardner
posted this on October 21, 2010 04:33 pm

The following video and article will teach you everything you need to know to embed Google Analytics tracking into your Unbounce landing pages.

 

What You Will Need

  • A Google Analytics Account
  • An Unbounce Account

 

  Embedding the Google Analytics Tracking Code

  1. Log in to your Google Analytics account
  2. Click the Admin button in the Google Analytics toolbar
  3. Select the Account you're working with
  4. Select the Property (site) you're working with
  5. Click  Tracking Info
  6. Enable Subdomain tracking and click Save
  7. Select and copy the tracking code then return to Unbounce
  8. Paste the tracking code into your landing page's Javascript library
  9. If using a Form Confirmation Dialog, paste the tracking code into your confirmation dialog as well
  10. Save and republish your page

That's it!

Google Analytics will then begin tracking metrics for your landing pages.

Next Steps

Event Tracking

To enable event tracking in Unbounce, follow these steps in the comments section.

 

Customizing Your Reports

Since the data collected from this integration is handled within your Google Analytics account, check Google's site for information on building customized reports.

 

Comments

User photo
Adam Riggs-Zeigen

A little confused on this:  You're recommending that it be placed "Before body end tag" but Google recommends placing within the <head> block and I notice that is an option in the drop down.  Why would Google recommend one thing and you guys another?

Thanks,

Adam

February 17, 2011 09:28 am
User photo
Oli Gardner
Unbounce

Sorry Adam, that's an error. You should place it in the head as per Google and our first set of instructions at the top (for the Asynchronous method). We'll get this updated.

February 17, 2011 03:18 pm
User photo
Adam Riggs-Zeigen

Cool thanks for the quick feedback

February 17, 2011 04:06 pm
User photo
Wes Wilson

Just some feedback: If I'm using Google Analytics, chances are I'm using them on ALL variants, and perhaps ALL campaigns. It'd be so much nicer if I could add it on an account or campaign level, instead of having to do this for EACH page.

March 15, 2011 11:13 am
User photo
Oli Gardner
Unbounce

Thanks for the feedback Wes. That's been a fairly common comment, so we'll definitely be considering it for a future update.

March 15, 2011 11:14 am
User photo
Michelle Montgomery

Oli, do I need to change my analytics settings from "A single domain (default)"  to "One domain with multiple subdomains" ?  The top graphic shows a script that is set for the multiple subdomains.  thanks!

April 10, 2011 08:12 pm
User photo
Oli Gardner
Unbounce
April 11, 2011 09:43 am
User photo
Jeff Weiss

Will adding Google analytics override the Unbounce conversion rate chart, or will they work in tandem?


April 29, 2011 08:00 am
User photo
Oli Gardner
Unbounce

Hi Jeff - they will both work in tandem.

April 29, 2011 01:21 pm
User photo
Jared Chung

Will GA be able to distinguish between variants? Will GA just be showing me the average results for all variants at a single URL or will I be able to distinguish between the performance of each variants through GA?

August 02, 2011 10:37 am
User photo
Carl Schmidt
Unbounce

Hi Jared!  Sorry we don't have a complete guide for customizing GA for use with Unbounce, that's definitely something we want to get around to.  If you want to track individual variants, you can customize your GA code, specifically the 'trackPageview' method, to include the variant information in the opt_pageURL parameter.  So, if you're using the async GA code, perhaps something like:

_gaq.push(['_trackPageview', '/my-unbounce-page/variant']);

The specific format will depend on how you're using GA and how you'd like your reporting to work.  Hope that helps!

September 21, 2011 11:07 am
User photo
Fred Perrotta

Since the lead-gen landing pages have a pop-up "Thank You" message and do not redirect to a different page, how do you set up Goals in Google Analytics?

September 27, 2011 03:46 pm
User photo
Oli Gardner
Unbounce

Hi Fred,

If you click on the form (not the button) you'll be able to choose where to go next (you can redirect to a different URL if you like) - just set it in the dropdown in the right-hand panel. This will let you set up a path of pages for your GA goals.

September 27, 2011 04:00 pm
User photo
Carl Schmidt
Unbounce

Hey Fred, I should add that the "Thank You" message is served up as a separate URL.  Just right-click and "View Frame Information" to see the URL that is requested.  You can either use that as your goal, or you can customize the GA script you embed on the form confirmation page...

September 29, 2011 11:38 am
User photo
Owen McGab Enaohwo

How do I push to Google Analytics when someone clicks on a button in unbounce?

January 11, 2012 11:26 am
User photo
Slan Dizier

Hi Owen,

Here are a couple steps you can take to track button clicks using Google Analytics.

1. You will need the button id, from the editor click on the button and on the right panel near the bottom in advanced you will see the id. For example it should look something like #lp-pom-button-66

2. Now we need to add a small code snippet to the button, to do this click on the Javascript tab in the footer of the page builder and add a new script with the following code.

<script>
$( '#lp-pom-button-66' ).click( function() {
    _gaq.push(['_trackEvent', 'Form', 'Submit', 'Email Submit Form']);

});
</script>

Make sure you replace what is inside the $() with your button id that you collected for step 1.

That should about do it.

If your not sure what the labels mean inside the push function a good article can be found at http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html

Let me know if that helped

Slan

January 11, 2012 12:47 pm
User photo
Zeb Couch

Hey folks - 

So according to Unbounce analytics, I have a few views so far. According to GA, however, I don't have any. Why is that?

 

Zeb 

January 23, 2012 07:53 pm
User photo
Slan Dizier

Hi Zeb,

It could be that Google did not publish the report  yet, It may take up to 24 hours to update.

http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55541

January 23, 2012 09:14 pm
User photo
Ryan Engley
Unbounce

We should have a video posted soon which will demonstrate how to enable goal tracking with Google Analytics for your landing pages.  In the mean time, all you should need to set it up is the URL of your thank-you page which by default is the form confirmation dialog.

Your page's form confirmation URL is based on the page's variant letter but is otherwise the same for any of your pages.  For example, if you had two variants, A and C, the URLs for each page's form confirmation dialog would be:

  • /a-form_confirmation.html and
  • /c-form_confirmation.html
Hope that helps configure Google Analytics goal tracking with your landing page and as always, if you have any other questions just let us know.

February 23, 2012 04:49 pm
User photo
Joel Simon

Hi there,

I need to track across multiple domains. My shopping cart is on another domain.

For my links going to my cart, I need to use the following structure:

<a href="http://www.my-example-blogsite.com/intro"
   
onclick="_gaq.push(['_link', 'http://www.my-example-blogsite.com/intro.html']); return false;">
   See my blog
</a>

How can I do it with Unbounce?

Thanks

August 06, 2012 10:17 pm
User photo
Joel Simon

I fund a way, I just forgot to re-publish the page :) (newbie mistake)

http://www.seomoz.org/ugc/google-analytics-cross-domain-tracking-ma...

It functions and we are now able to track the across multiple domain.

August 07, 2012 12:44 am
User photo
Adriel Michaud

You guys should crank out one of these how to's for adding the Google ReMarketing code for Adwords. Should be similar.

August 07, 2012 09:44 am
User photo
Ryan Engley
Unbounce

@Joel - glad to hear you were able to puzzle it out.  Thank you for letting us know!

@Adriel - We're always looking for ways to improve our resources and appreciate your feedback.  Thank you!

August 08, 2012 12:49 pm
User photo
Martin Eriksson

This really needs to be a lot easier - I thought the USP for Unbounce was that you didn't need to be technical to manage and create landing pages, but now to track it in GA I have to get our marketing team to remember to add the right tracking code to each new page, in the right place, and I can forget about getting them to customise the tag to track variants.

September 24, 2012 01:04 am
User photo
Suzan Szollar

Slan - I set up google analytics for the domain URL and I I added the code snippet above for button click tracking to all the sub-pages where I have buttons (in this case I'm using unbounce to guide people through a sequence of about 10 A/B tests), but I can't figure out how to set up the tracking in google analytics. I'm staring at the goals page and the event tracking guide but this will take me forever to figure out. What is the next easy step? 

September 27, 2012 09:12 am
User photo
Slan Dizier

Hi Suzan,

Are you asking on how to set up goals in Google Analytics? I find that this step-by-step to be a good reference.  http://support.google.com/analytics/bin/answer.py?hl=en&answer=1032415.  If I have misunderstood your question or this did not help please let me know.

Slan

September 27, 2012 09:57 am
User photo
Suzan Szollar

Thx Slan, I read this page but what it doesn't help with is the specifics for goal tracking for button clicks. Up above in this thread you give instructions for how to add the code snippet on the unbounce side, what do I need to do on the GA side? I'm assuming I need to set up an event, but this is too generic to help me:

Event: Specify an Event as a Goal. In order to set this kind of goal, you must first set up Event Tracking. Under Goal Details, configure a combination of Event conditions (e.g., the Event Category, Action, Label, or Value). You must select at least one condition. Choose a Goal Value for the Event. The actual Event Value is the value you assigned to the Event when you set it up. The Constant Value can be entered manually in this field.

And this is too complex to help me: https://developers.google.com/analytics/devguides/collection/gajs/e... 

And I don't think the URL tracking will work because I use the same URL as the landing page across multiple variants of the same page, but I want to see the clicks by variant, not the total clicks to the URL.

Thx

September 27, 2012 03:26 pm
User photo
Slan Dizier

Hi Suzan,

I agree it is a bit confusing since there is so much on the GA side of things but once you get the hang of it I promise it's not so bad.  

So basically what you need to do is tell GA what type of goal you want to set up.  These can range from clicking on a link, to the amount of time that a user spends on your page and even specific events that happen such as submitting a form etc.  So within your account on the left side menu you will find goals by following that you can create a goal and Google will give you a few basic questions to set that up.  

It's hard for me to go into specifics since I am not sure what exactly it is you want to do.  What I recommend before you start is to ask your self what information it is that is important for you and your business to help you convert.  To me it sounds like what you need is to set up a funnel which is a part of goals that help you understand at what point your users are engaged and what part they drop off at.   I highly recommend getting familiar with this.  A very good and short read is this article

 http://analytics.blogspot.ca/2009/05/how-to-setup-goals-in-google-analytics.html 

It will help you understand the basics of setting up GA including funnels.

I hope that helps :)

Slan

 

 

 

September 27, 2012 09:28 pm
User photo
Aereo Marketing

Hey Guys - 

Let's say I want to track my unbounce pages, as subdomains, in GA. And I also want the reports to be aggregated into a single view, so that the hosted pages are a subdomain that are tracked in the same GA view. Is this doable? Is it a matter of setting up the right profiles in GA?

Thanks,
Matt 

October 08, 2012 02:53 pm
User photo
Michael Tsidulko

Hi team,

You guys are doing great work. I like your product but I'm very impressed with how dedicated you are to making Unbounce easy and user friendly. Keep it up!

Quick question: if using a custom domain name, while setting up GA do I use the unbounce or my custom domain?

Thanks,

Michael

December 13, 2012 01:15 am
User photo
Ryan Engley
Unbounce

Hi Michael - thank you so much!  If you're using your own domain, be sure to configure GA to use your custom domain so it fits with your existing reports.  The only extra point is that if you're using a custom subdomain, you'll want to ensure you've selected the tracking for subdomains option in GA.

Matt - You sure can and yes, it's a matter of the configuration in GA.  Truthfully, I'm not familiar enough with that aspect of GA though I did track down a post about tracking multiple subdomains in GA that should coach you through it. 

December 13, 2012 04:10 pm
User photo
Wesley Blundy

I was pulling my hair out trying to get the GA goals working on the email form submission..... tried 

/a-form_confirmation.html

no luck..... anyway, I eventually got their in the end after a few hours. 

Make sure you add the GA code snippet to ALL pages, not just your main page. In this case, the success lightbox is a page, and thus needs the GA code added to HEAD, just like the front page. 

Hopefully this saves someone else some angst. 

Cheers

ps. Ryan - I love the site - thanks. 

May 22, 2013 02:56 am
User photo
Ryan Engley
Unbounce

Hey Wesley - glad to hear it and thanks for the heads up. I'll update the video asap.

May 22, 2013 09:18 am
User photo
Alban Sauvanet

Hello, thank you for the info. But I want to put a code, like a google event, when the customer click on the CTA button. How ?

June 06, 2013 12:54 pm
User photo
Ryan Engley
Unbounce

Hi Alban - You can tie a google event to your CTA using a little bit of javascript but don't worry, there's no programming required. Just check out this comment above from Slan on our product team. He explains exactly how to set it up.

June 06, 2013 01:35 pm
User photo
Alban Sauvanet

Thank you Ryan but there is no "script button" on my editor. I looked at the video and I can see them in the demo, on top, next to the delete button, but not on mine. Strange...

June 07, 2013 01:56 am
User photo
Ryan Engley
Unbounce

Hey Alban - we released an update to our page builder just a couple weeks ago and you managed to catch outdated info in that comment. The Google Analytics integration steps are still the same but rather than clicking the Scripts button in the toolbar, you'll click the Javascript tab in the footer of the editor: http://support.unbounce.com/entries/513757-Can-I-use-custom-JavaScr...

...thanks for pointing out the issue. We'll hop in a fix it up ASAP.

June 07, 2013 09:39 am
User photo
Kevin Starke

Do I put the event script Slan put in the comments into the Header, Before Body End Tag, or After Body Tag in the Javascripts section?

June 13, 2013 05:50 pm
User photo
Slan Dizier

Hi Kevin,

You'll want to put the code into the head tag.  Google does a great job making sure that it does not slow your page down by doing all its magic as your page is loading.

I hope that helps,

Slan

 

 

June 13, 2013 05:57 pm
User photo
Kevin Starke

Has the script that should be inputed changed since 2012? I have placed the code into the Header and changed the button code and set up the Google Event using the same fields (Form, Submit, Email Submit Form) but the events are not being tracked.

June 14, 2013 09:53 am