This document will detail the Magic Functions available in the API and how to use them in the data parameter. The Magic Functions are described below:

Functions

Keywords

The following functions will return the keywords found in a site ones is being acceded by  organic search through a PPC campaign. These are base in the search term user by Google and Bing.

  • Organic search Keywords:  The following functions will get the keywords based in a organic search made in Google or Bing.

    • __bingKeywd : Will get the keywords based in an organic search made in Bing.
    • __gaKeywd: Will get the keywords based in an organic search in Google.
  • PPC Keywords: Will get the keywods from a PPC Campaign from Google or Bing.

    • __gaPpcKeywd: When it is been acceded to the site through a Google PPC Campaign, this function will get the keywords related to that PPC Campaign.
    • __bingPpcKeywd: When it is been acceded to the site through a Bing PPC Campaing, this function will get the keywords related to that PPC Campaign.
    • __ppcKeywd: When it is been acceded to the site throught a Bing or a Google PPC Campaign, this function will get the keywords related to PPC Campaign.

Source Type

It is possible to get the source type the pages has been acceded. were we have acceded to the page, Organic, Direct or PPC are the possible values. We only have one function for getting the source type and this is __sourceType.

Url

The following functions will return details related to an URL. There are two group of functions. Referred URL and Current url.

  • Referred URL: This will get the referred url of the current page. The function for this is:
    • __rUrl
  • Current URL: These are the functions which will get information of the current url. The functions used for getting these details are:
    • __cUrl: Will return the hostname and port of a URL.
    • __lUrl: Will return the hostname and port of a URL. A session will be created so the same search will be returned in the rest of the site.
    • __cPage: Will return the relative path of the page in the current URL.
    • __lPage: Will return the relative path of a in the current URL. A session will be created so the same search will be returned in the rest of the site.
    • __cQueryStr: Will return the query string of a URL.
    • __lQueryStr: Will return the query string of a URL. A session will be created so the same search will be returned in the rest of the site.
    • __cUrlPage: Will return the hostname,port and path of a URL.
    • __lUrlPage: Will return the hostname,port and path of a URL . A session will be created so the same search will be returned in the rest of the site.
    • __cUrlPageQueryStr: Will return the hostname,port, path and querystring of a URL.
    • __lUrlPageQueryStr:Will return the hostname,port, path and querystring of a URL. A session will be created so the same search will be returned in the rest of the site.