Insights

Adding Javascript to Unbounce

Adding Javascript to Unbounce

Posted April 3, 2019
By Cody Hanson |

Track What Matters

Creating a customized landing page is an excellent way to communicate your message effectively. However, without metrics to measure what works and what does not, you’re managing your campaign in the dark. Thankfully, Unbounce provides the ability to insert Google Tags so you can track your campaign's performance. 

If you’re one of the people managing your campaign in the dark, never fear, we will shed some light on how to add javascript to your Unbounce landing page.

Adding Google Analytics Code

Google Analytics is the most important tag you add to your landing page. Unbounce has two options to connect your landing page to analytics.

Method 1

The first (and easiest) method is using script manager.

  1. Log in to Unbounce.
  2. Under settings, select script manager.
  3. Select add a script in the top right-hand corner.
  4. Add your website tracking ID. To find this, log in to Google Analytics and go to Settings > Tracking Info > Tracking Code. Your tracking ID will be visible at the top of this page. Copy and paste this ID into the Unbouce script manager and click add script details.

    Screen Shot 2019 04 04 at 2 51 41 PM

  5. After selecting add script details a new box, Script Usage, will appear. In the Script Usage field, select the subdomain(s) where you'd like to apply the Google Tracking Script.

    Screen Shot 2019 04 04 at 2.54.44 PM

  6. Select save and publish script.
  7. Republish the page.

Once this is completed, you will have successfully linked your Google Analytics account.

Method 2

The second method is manually adding your Google Analytics code to the landing page javascript.

  1. Log in to Unbounce.
  2. Choose the landing page where you want to add the analytics tag.
  3. Click edit on the variant where you want to add the analytics tag.
  4. At the bottom of the page select javascript > add new javascript.

    Screen Shot 2019 04 04 at 3 00 18 PM

  5. Under the manage scripts window, enter your script name. Here, we called our script, "Google Analytics Code."
  6. Set your placement to head.
  7. Add your analytics tracking code. To find this, log in to Google Analytics and go to Settings > Tracking Info > Tracking Code. Copy the Global Site Tag and paste it into line one in the manage scripts window.

    Screen Shot 2019 04 04 at 3 04 07 PM 

  8. If you’re using a form confirmation dialog you will need to add this Global Site Tag to this page as well using the same instructions as above.
  9. Click save code.
  10. Republish the page.

Verify Analytics is Setup

To verify that analytics is properly set up using either method, open two new tabs in your browser. In the first tab, navigate to the landing page. In the second tab, log in to Google Analytics. In analytics under real-time reports, you should see at least one visitor on the page if analytics is tracking properly. You can also open Google Tag Assistant on your homepage to see if the analytics tag is firing properly.

Adding Google Conversion Tracking

To properly track conversions that occur on your landing page you will need to install Google conversion tracking to your Unbounce page. To do this, you will first need to create a conversion action within Google Ads.

  1. Log in to Google Ads.
  2. Click tools and add a new conversion.
  3. Click website then follow the prompts to set up your conversion action.

    Screen Shot 2019 04 04 at 3 13 54 PM

  4. Click create and continue.
  5. To install code manually, download the Global Site Tag and Event Snippet codes so you can add them to your landing page.

After you’ve created your conversion action you will need to add the Global Site Tag and Event Snippet to the landing page.

  1. Log in to Unbounce.
  2. Choose the landing page where you would like to add the conversion tracking code
  3. Click edit on the variant you want to add the conversion tracking code to.
  4. At the bottom of the page click javascript > add new javascript.
  5. Under the manage scripts window, you will need to add the Global Site Tag and set the placement to head.

    Screen Shot 2019 04 04 at 3 20 59 PM

  6. Copy and paste the Global Site Tag created when the conversion action was set up.
  7. In the form confirmation dialog box, you will need to add two scripts, one for the Global Site Tag and the other for the Event Snippet. Add both placements at the head.
  8. Click save code.
  9. Republish the page.

Verify Conversions are Tracking

To verify that conversions are tracking, you will need to test your conversion action on the landing page. If you have a form confirmation dialog you can use Google Tag Assistant to verify that your conversion tag is firing correctly. You will also want to check Google Ads to confirm conversions are recording properly.

Tags

Creative. Media. Strategy

Never Miss an Update

Never Miss an Update

Cookies & Privacy

This website uses cookies to create a positive online experience that is informative and personal while providing additional user-functionality. By continuing to use this website, you agree to our use of cookies as described in our Privacy Policy.