DIL Tools

WARNING
Beginning in July 2023, Adobe has discontinued the development of the Data Integration Library (DIL) and the DIL extension.
Existing customers can continue using their DIL implementation. However, Adobe will not be developing DIL beyond this point. Customers are encouraged to evaluate Experience Platform Web SDK for their long term data collection strategy.
Customers looking to implement new data collection integrations after July 2023 should use Experience Platform Web SDK instead.

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();
recommendation-more-help
de293fbf-b489-49b0-8daa-51ed303af695