Show Menu
TOPICS×

DIL Tools

Describes methods in the DIL.tools namespace. These utility functions help you perform specific tasks.

getSearchReferrer

Returns search terms used to reach the current page.

Purpose of getSearchReferrer

In DIL, getSearchReferrer returns search results (names and key words) used to reach your site. You can pass in specific search terms to this function or let it search the supported search engines ( AOL, Ask, Bing, Google, and Yahoo) against document.referrer by default.

Function signature

Function signature: DIL.tools.getSearchReferrer(uri, initConfig)

Function Parameters

getSearchReferrer accepts:
  • {string} : (Optional) A string containing the search URL (uses document.referrer if undefined).
  • {object} : (Optional) An object containing the configuration for the hostPattern , queryParam , or queryPattern .
And returns:
  • {object} An object that contains valid names and keywords.

Examples

Search Type Description Code Sample
Default Search Returns keyword search terms used by the AOL, Ask, Bing, Google, and Yahoo search engines. var results = DIL.tools.getSearchReferrer();
Pass in a Custom URL Returns the search referrer based on a custom URL. var results = DIL.tools.getSearchReferrer("https://www.ehow.com/search.aspx?q=adobe+rules");
Match URL Hostname with a Custom Regex Pass in a custom regex to match the host name of the referring URL. var results = DIL.tools.getSearchReferrer("https://www.ehow.com/ search.aspx?q=adobe+rules",{    hostPattern:/ehow\./,    queryParam:"p" });
Match Search Patterns with a Custom Regex Pass in a custom regex to perform a custom search. var results = DIL.tools.getSearchReferrer("https://www.ehow.com/search.aspx?q=adobe+rules, {    hostPattern:/ehow\./,    search_pattern:/[&\?]p=([^&]+/ });

decomposeURI

Disassembles a Uniform Resource Identifier ( URI) into its constituent components: hash , host , href , pathname , protocol , search , and [uriParams] .
Function signature: DIL.tools.decomposeURI

Function Parameters

decomposeURI accepts:
  • uri {string} : (Optional) A string containing the URI. Defaults to document.location.href if not specified.
And returns:
  • {object} : An object that contains valid names and keywords.

Sample Code

var uriData = DIL.tools.decomposeURI('https://www.adobe.com/?arg1=123&arg2=456#am'); 
{ 
  hash : "#am", 
  host : "www.adobe.com", 
  hostname : "www.adobe.com", 
  href : "https://www.adobe.com/?arg1=123&arg2=456#am", 
  pathname : "", 
  protocol : "https:", 
  search : "?arg1=123&arg2=456", 
  uriParams : { 
    arg1 : "123", 
    arg2 : "456" 
  } 
}

getMetaTags

Searches for specific content defined in the meta tags on a Web page and returns that data in an object.

Function signature

Function signature: DIL.tools.getMetaTags( 1 or more parameters)

Function Parameters

getMetaTags accepts one or more name parameters (string type) to search for. It returns an object composed of key-value pairs.

Sample Code

var dataLib = DIL.create({ 
     partner: '

partnerName'

, 
     containerNSID: 

containerNSID

 
}); 

dataLib.api.signals(DIL.tools.getMetaTags('

application

', '

keywords

',  '

description

'), 'c_').submit();


var dataLib = DIL.create({ 
     partner: 

`partnerName'

, 
     containerNSID: 

containerNSID

 
}); 

dataLib.api.signals(DIL.tools.getMetaTags('

application

','

keywords

', '

description

'), 'c_').submit();