When using Upgraded URLs, the serving URL for an ad or ad extension is constructed by combining various fields according to a predefined set of rules. This document examines these rules in more detail.
AdWords entities hierarchy
When resolving various Upgraded URL fields, the following hierarchy (highest to lowest) is used by AdWords servers:
Customer
Campaign
Ad Group
Ads
Ad Group Criteria
FeedItems (including sitelinks)
Which final URL is used?
We use the final URL by default when building the serving URL. If an entity is served on a mobile network and has a valid mobile final URL, then that is used instead of the final URL. Final app URL is currently supported only for mobile re-engagements ads.
Serving URL expansion rules
There are 4 steps involved when expanding the serving URL for an AdWords entity.
1. Decide which values to use for various fields
a. Determine which final URL to use
Start by determining which final URL you should use. This varies depending on the entity involved.
Entity | Which final URL to use? |
---|---|
FeedItems (sitelinks) | Always use own final URL. |
Ad X served on keyword Y | If the keyword has own final URL, use it. Otherwise use the ad’s final URL. |
b. Determine which tracking URL template to use
The tracking URL for an entity is determined by traversing its object hierarchy, and choosing the value from the entity lowest in the hierarchy. If no tracking URL template values can be found in the hierarchy, then set tracking URL template’s value to empty.
E.g. If you are determining the tracking URL template for an ad, and it has tracking URL template values defined only at its parent ad group and account levels, then use the value from the parent ad group.
c. Determine which custom param values to use
The value for a given custom param is resolved by traversing the object hierarchy, and choosing the value from the entity lowest in the hierarchy. If no value is defined for the custom param, then an empty string is used as its value.
E.g. If you are determining the value for a particular custom param at the ad level, and that custom param has values defined at its parent ad group and at the account level, then use the value from the parent ad group.
2. Expand the final URL
a. Expand the custom param values
Parse the final URL and substitute the values for each custom parameter in the URL using the values you determined in the previous step.
b. Expand the ValueTrack tags in the URL
Parse the final URL, and substitute values for any ValueTrack tags present in the URL.
c. Strip the {ignore} tag
Any {ignore}
ValueTrack parameter in the expanded final URL is removed.
3. Expand the tracking template
If you have an empty value for tracking template as determined from an earlier step, then you can skip this step. Otherwise, the tracking url template should be expanded as follows:
a. Expand the custom param values
Parse the tracking template URL, and substitute the values for each custom parameter in the URL using the values you determined in the previous step.
b. Expand the ValueTrack tags in the URL
Parse the tracking template URL, and substitute values for any ValueTrack tags present in the URL.
c. Substitute {lpurl} parameter in tracking template
If the tracking template URL contains {lpurl}
or one of its variants,
then substitute it with the expanded final URL.
- If
{lpurl}
is inserted at the beginning of the tracking template, then it is not escaped. If it is elsewhere in the tracking template, it escapes the characters ?, =, ", #, \t, ', and [space]. {unescapedlpurl}
is always unescaped{escapedlpurl}
is always escaped{lpurl+2}
is always escaped twice{lpurl+3}
is always escaped three times
4. Pick the serving URL
If your tracking template URL is empty, then use the expanded final URL from step 2. Otherwise, use the expanded tracking template URL from step 3.
An exception to this rule is sitelinks: If the tracking URL template from
step 1.b does not contain the {lpurl}
parameter, then the sitelink’s final
URL is used as the serving URL.
An example
Consider an account with the following structure:
Account
Campaign 1
Ad Group 1
Ad 1
Keyword 1 (shoes)
Keyword 2 (hats)
Ad Group 2
Ad 2
Ad 3
Keyword 3 (watches)
FeedItem 1 (sitelink 1)
Assume that the following upgraded URL fields are defined on these entities
Entity name | Tracking URL template | Final URL | Custom Parameters |
---|---|---|---|
Account | http://www.cid1-tracking.com/?{_myid}&u;={lpurl} |
||
Campaign 1 | _mycampaign=cam1 |
||
Ad Group 1 | http://www.ag1-tracking.com/?{_mycampaign}&u;={lpurl}&{_myid} |
_myid=ag1id |
|
Ad Group 2 | myid=ag2id |
||
Ad 1 | http://www.creative1-final.com/?{keyword}{ignore}&{_myid}&{_mycampaign} |
||
Ad 2 | http://www.creative2-final.com/?{keyword}{ignore}&{_myid} |
_myid=ad2id |
|
Ad 3 | http://www.ad3-tracking.com/?{_mycampaign} |
||
Keyword 1 | final URL: http://www.kw-final.com/?{keyword}{ignore}&{_mycampaign} mobile final URL: http://m.kw-mobile-final.com/?{keyword}{ignore}&{_myid}
|
_myid=k1Id |
|
Keyword 2 | |||
Keyword 3 | |||
FeedItem 1 | final URL: http://www.sitelink-final.com/?{keyword}{ignore}&{_mycampaign} mobile final URL: http://m.sitelink-mobile-final.com/?{keyword}{ignore}&{_myid}
|
For expanding the ValueTrack parameter {keyword}
, we will use the
following values:
- Keyword 1: shoes
- Keyword 2: hats
- Keyword 3: watches
The following sections show how various parameters get resolved for each of these entities.