This article explains how to configure destination goals in the most common scenarios. For more general information about how to set up goals, read Set up and edit goals.
In this article:Fixed URLs
http://myownpersonaldomain.com/2008/category/name-of-blog-post/
http://examplepetstore.com/dogs/food.php
http://examplepetstore.com/cats/food.html
To configure goals for these types of URLs:
- First verify that the URL for the goal is both unique to that page/Goal, and consistent from view to view.
If the URL is the same across multiple steps in the goal process, see Identical URLs Across Multiple Steps (below). If the URL changes from view to view, or if it has name/value parameters, see the instructions for dynamically-generated URLs. - Destination: Enter the request URI part of the goal.
The request URI is that part of the URL that comes after the domain address. Using the URL examples listed above, you would enter:/2008/category/name-of-blog-post/
/dogs/food.php
/cats/food.html
- Case sensitive: Check this box only in the situation where you want to match only one of two identical URLs which differ only by case (e.g.
/contactus.html
and/CONTACTUS.html
). - Match Type: Use the match type that works best for your purpose. In most situations, the default (Equals to) match works well. See Match types below for more details.
- Value: If you have an imputed value for your page, turn this option on and enter that value in the field. See About goals, goal Value for more information.
Ecommerce transactions
To track transactions, you'll need to add Ecommerce tracking code to your shopping cart. This allows Analytics to calculate the Revenue and ROI metrics from purchases on your site. However, it's often useful to also create a destination goal to signal the completion of an ecommerce transaction. Setting up a destination goal will allow you to see the percentage of sessions that resulted in at least one transaction (i.e., this will be the conversion rate for that goal).
If you set up a destination goal to signal the completion of an Ecommerce transaction, leave the goal Value field blank. The actual value of the transaction will appear in the Revenue metric (not the Goal Value metric) and will come from the Ecommerce tracking code in your shopping cart.
Once you have defined Ecommerce tracking and can verify that the transaction data is being sent to Analytics, configure your destination goal as follows:
- For destination: Supply the URL for your "thank you for purchasing" page. For example:
http://we-sell-for-you.com/mysite/myCart_receipt_thankyou.asp
- Match Type: Typically, Begins with is the best choice for shopping pages, since shopping cart URLs often append a number of parameters to the end of the URL to pass data to the Ecommerce server. You can test your shopping cart to determine the structure of the URL and set the match accordingly. See Match Types below for more details.
- Goal Value: If you’re tracking an Ecommerce transaction, leave can this blank. Use the Revenue in your Ecommerce reports to see how much an action is worth.
Dynamically generated or variable URLs
If your URLs include query terms or have parameters at the end, use either Begins with or Regular Expression match types when entering funnel or destination goal URLs. Examples of dynamic or variable URLs are:
- http://example.com/about/pageWithParameter.html?id=89
- http://example.com/sales/JanuaryOffer.html?utm_source=NewsLetterJan&utm_medium=email
- http://sports.example.com/checkout.cgi?page=1&id=002
See Match Types below for more details.
Identical URLs across multiple steps
In some situations, the URL doesn't change across a sequence of activity. For example, a sign-up process might have the following URL path:
- Step 1 (Sign Up):
example.com/sign_up.cgi
- Step 2 (Accept Agreement):
example.com/sign_up.cgi
- Step 3 (Finish):
example.com/sign_up.cgi
In general, we recommend that you:
- Set up event tracking to track flows like this.
- Use an event goal instead of a destination goal.
However, advanced users may want to track users' progress through a funnel with the same URL for each step. To do this, you need to modify your tracking code to create a virtual pageview for each step in the sequence that you want to track.
You can pass the ga
function a send
command with the pageview
hit type and override the default page value with a URL you fabricate, as described in the Developer Guide. For the above example, the modifications to your analytics.js tracking code might look like this:
ga('send', 'pageview', '/funnel_G1/step1.html');
ga('send', 'pageview', '/funnel_G1/step2.html');
ga('send', 'pageview', '/funnel_G1/step3.html')
;
Finally, define your funnel and destination goal URLs using the ones you created in the tracking code modifications.
Goals for multiple criteria
You can define a goal for multiple criteria, such as an interaction with two specific sections of your website, or a go to any page within a sub-directory of your website. To do this, use Regular expression as your match type. See Match types below for more details. The following examples illustrate these scenarios:
- use
^/sports/.*
to match a goal when any page within the sports directory is viewed - use
sports.html|music.html
to match a goal when a user views either the sports.html or music.html pages
Goals on other sites
If the destination you want to use as a goal is on another site, see Goals and funnel steps on third-party sites.
Tips for setting up funnels
When you create a destination goal, you also have the option to create funnel for that goal. A funnel is a sequence of pages that you anticipate users seeing before they reach the goal. Report data for the funnel appears in the funnel Visualization report.
Before creating a funnel, keep in mind the following:
- Test the sequence on your website, and make a note of all pages that make up the entire sequence of activities you want to track for the goal.
- The final page of the sequence is the actual goal, and its URL should be entered in the destination field, not the funnel section.
- The match type you select for the destination also applies to any URL in the funnel section.
- Omit the domain name of the URL in each funnel step (e.g.,
http://example.com/aboutUs.html
should be entered as/aboutUs.html
) - If you make the first step of the funnel mandatory, the conversion count for the funnel Visualization report will include only those users who reached the goal via that first step. Otherwise, the conversion count for the goal will be the same in all reports.
To define a funnel:
- Open or create a destination goal.
- Turn on the funnel option, and enter a name for that step that you want to appear in the funnel reports. For example, you might want to use Welcome as the name for welcome.html.
- Enter the URL for the first page in the funnel for Step 1.
- To make the first step required, click the Required step toggle to turn it ON.
- For additional funnel steps, click +Add another Step, and supply the name and URL for each page. Note: remember not to enter the final page of the process in the funnel section, but in the Destination field.
- When you have finished adding pages, click Create goal (or Save goal).
To verify that the funnel is working, view the funnel Visualizations reports to see data there.
Match Types: Begins with, Equals to, & Regular Expression
There are three diferent match types that define how Analytics identifies a URL for either a goal or a funnel. The match type that you select for your goal URL also applies to the URLs in the funnel, if you create one.
- Equals to—for standard, fixed URLs:
An Equals to match is an exact match on every character in your URL—without exception—from beginning to end. Use this when your URLs for your site are easy to read and do not vary.
This option requires that the URLs you provide for your funnel or goal exactly match the URLs shown in the reports. There can be no dynamic (changing) information in the URL such as session identifiers or query parameters.
If you are using an Equals to match for a goal (e.g.,/shopping/thanks.html
), leading or trailing whitespaces in the destination field will invalidate the goal. - Begins with—to eliminate trailing URL parameters:
This matches identical characters starting from the beginning of the string up to and including the last character in the string you specify. Use this option when your page URLs are generally unvarying but when they include additional parameters at the end that you want to exclude.
If your website has dynamically generated content, use a Begins with match filter and leave out the unique values.
For example, a URL that a particular user went to might be
http://example.com/checkout.cgi?page=1&id=9982251615
. In this case, theid
varies for every other user. You could still match this page by using/checkout.cgi?page=1
as the URL and selecting Begins with as your match type. - Regular Expression Match—for matching on multiple criteria:
A regular expression uses special characters to enable wildcard and flexible matching. This is useful when the stem, trailing parameters, or both, can vary in the URLs for the same webpage.
For example, if a user could be coming from one of many subdomains, and your URLs use session identifiers, you could use a regular expression to define the constant element of your URL. For example,
checkout.cgi\?page=1
will matchhttp://sports.example.com/checkout.cgi?page=1&id=002
as well ashttp://fishing.example.com/checkout.cgi?page=1&language=fr&id=119
.As another example, you could use regular expressions to set a goal for a user goes to any page in a subdirectory:
^/sports/.*
.
Verifying Correct URL Expressions for goals
You can verify that you have written a goal URL correctly by searching for the page in the Pages report using the exact URL or regular expression you want to use in creating your goal. If you are able to successfully view the pages you expect after doing a search, you can safely assume your URL or expression will work.
ExamplesBegins with
Suppose your pet store website has a number of pages in a single directory, and you want to use a Begins with match URL to create a goal only for the fish-related pages, which all have the same structure:
- /supplies/fishFood.html
- /supplies/fishTanks.html
- /supplies/fishTankDecorations.html
To determine whether your matching URI works, go to the All Pages report for your site, click the advanced button, and choose Include, Page, and Begins with before the search field. To match the URLs above, you would enter /supplies/fish in the search field. If your search returns those pages you expect to match, you can use that same URI string as your goal URL.
Regular Expression Match
Because the All Pages report allows regular expressions in the search field, it's a great place to verify whether your regular expression will work as a goal. For example, the Analytics documentation on Google Developers Site for Analytics has a number of pages that have collection as part of the file name. For example:
- https://developers.google.com/analytics/devguides/collection/analyticsjs/
- https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced
While many of those files are in the /collection
directory of the site, some of them don't. In order to set a goal that converts on all traffic that goes to pages with collection as part of their name, a regular expression is required. A search in the All Pages report in the Behavior Reporting section using the regular expression .*collection[^/]*html$
verifies that this expression matches all files that contain collection and no other files.