DoubleClick Natural Search

Deploy the natural search tag to your landing pages

Customer support will send the DoubleClick Natural Search tracking tag to you. Have your webmaster post this tag within the body of each page that might receive traffic from a search engine visit.

Here's an example of the Natural Search tag that DS support gives you. It generates and passes a random number to perform cache-busting.


conversionTag = ";sz=1x2;ord="

var randomNumber = Math.floor((Math.random() * 1000000000000) + 1);
var scriptTag = document.createElement("script");
scriptTag.src = conversionTag + randomNumber + "?";
scriptTag.language = "JavaScript1.1";

var insertionNode = document.body.firstChild;
insertionNode.parentNode.insertBefore(scriptTag, insertionNode);


To ensure accurate tracking:

  • The tag should be posted on every page that might receive traffic from a search engine visit, even vanity pages.

  • Post the tag close to the top of each page and within the HTML body tag.

  • The tag must be called upon every page load.

For questions regarding privacy, refer to the DoubleClick Privacy page or contact customer support.

Use Google Tag Manager to deploy the natural search tag

Google Tag Manager makes it easy to manage tags from multiple Google sources, such as Google Analytics, Floodlight, etc. If you’re using Google Tag Manager for your site, follow these steps to deploy the DoubleClick Natural Search tag:

  1. Go to, sign in, and access your site’s container.

  2. If you haven't already created a custom variable that can generate a random number, enable the built-in Random Number variable:

    1. In the left navigation panel, click Variables.

    2. In the Utilities box, select Random Number.

  3. Create a tag that is called on every page load:

    1. In the left navigation panel, click Tags.

    2. Click the New button.

    3. Replace Untitled Tag with a name that's meaningful to you.
      For example, enter Natural search tag.

    4. On step 1 Choose Product, click Custom HTML Tag.

    5. On step 2 Configure Tag:

      1. Paste the Natural Search tag from DS customer support into the HTML field.
      2. In the tag, set the value of the ord parameter to {{Random Number}} or to the name of your custom variable that generates a random number. 
      3. Click Continue
    6. On step 3 Fire On, click All pages.
      Create a natural search tag that fires on all page views.

    7. Click Save Tag to save your new tag.

  4. Follow the standard publishing process for Google Tag Manager:

    1. Create a container version.

    2. Preview and debug the version.

    3. Publish the new version.

For each page load, the tag determines if the referrer is a natural search result. If the page was visited as the result of clicking a natural search result, the tag "fires" and reports a natural search result. 

Test the deployment from Google Tag Manager

If you used Google Tag Manager to deploy your tag, do the following to test the deployment:

  1. In a Chrome web browser, visit the Chrome Web Store and install the Google Tag Assistant.

  2. Visit your site through a natural search result.

  3. Use the Tag Assistant to check that the Natural Search tag has fired.

  4. Visit another page on your site without clicking a search result.

  5. Use the Tag Assistant to check that the Natural Search tag did not fire.

Webmaster FAQs


Does this tag replace Floodlight tags?
The DoubleClick Natural Search tag is not itself a Floodlight tag. It is the tag responsible for tracking arrivals or visits from search engines and therefore is the essential part in DoubleClick Natural Search tracking.


Where on the page should the tag be posted?
The tag must be called every time the page loads. Posting the tag close to the top of the page within the HTML body tags is preferred. This will result in the most accurate tracking.


Can I use server-side include or some other language like Perl for the cache busting?
Yes, the webmaster may use whatever method as long as the tag contains a sufficiently random dynamic string. The JavaScript wrapper provided by DoubleClick is meant to facilitate implementation and is only a suggestion. Client-side cache busting is preferred to server side.


How long do I leave the tag up on the site?
The tag must remain in place for DoubleClick Natural Search tracking to occur. The tag should not be posted, removed, and re-posted repeatedly. The tag should not be conditionally written to the page.


The tag is negatively affecting my page load time. Can I take it down?
The tag is very small, about 2.4 kb, and it's designed to have a minimal impact on page load. DoubleClick Natural Search tracking cannot occur without the tag in place.


I don’t want a DoubleClick ad tag on my homepage. What can I do?
Search engines most often direct users to the homepage. Therefore, the homepage may be the most important location for the tag to be posted. If the tag is not present, DoubleClick Natural Search tracking cannot occur.


I have dynamically generated pages. Where should I post the tag?
The tag needs to render along with page content and load with each page request.


On what other pages should I post the tag?
Post the tag to any page that might be the landing page for a natural search visit. This includes vanity pages, temporary pages, or any associated pages that need to be tracked. For example, some clients maintain an About Us page.


On what pages should I include the exclusion parameter?
If you are running Paid Search campaigns, use this exclusion parameter on every page that the tag is used. If this is not done, natural search visits will not be counted. Implement the exclusion parameter like any other query string value. If no query string exists, add a new one. If your server does not support arbitrary exclusion parameters in the page URL, consult the implementation specialist for an alternate method.


Was this article helpful?
How can we improve it?