Logo of RobustHost, developer of high quality webmaster tools.
Home About Us Contact Us Support Download Products
DynAds Basic banner ad rotation and tracking script
DynAds
Main Page
Features
Demo & Test
Documents
F.A.Q.
 
Order Online
 
Related Products
DynAds Pro
 
Testimonials
 

Sample Testimonial
Thank you very much for your extremely helpful and detailed reply. I adapted your sample script and was able to achieve exactly what I was looking for. Once again I am amazed at both the flexibility of your product and your incredible technical support! Best Regards.
B. Brooks, BetterWhoIs.com More...

Affiliates

What is DAG API?

Display Ad Group (DAG) API is an application programming interface written in JavaScript to help webmasters to develop better ad/content displaying methods and work in a clean, well organized environment. DAG API contains many functions and classes that hides the difficult task of managing browser incompatibilities and JavaScript pitfalls. In addition, since DAG API is organized as classes, data access is easy and well organized.

DAG API loads itself and the ad contents from DynAds server. Ads can be loded, during the page load as DAG class objects or from cookies. Further more, ads can be accessed dynamically after page load

The following code segments show how to load DAG API, how to load ads as cookies, how to load ads dynamically as cookies, and how to load ads as DAG class objects directly.

<!-- Load the DAG API before any script referencint it --> 
<SCRIPT LANGUAGE="Javascript" TYPE="text/javascript"
  SRC="http://YourDomain/YourPath/ad.pl?md=api">
</script>
<!-- Here, the DAG API is loaded --> 

<!-- Show how to load an ad as a cookie from server during page load --> 
<!-- Load a random ad from ad group AdGrp1 as a cookie --> 
<IMG SRC="http://YourDomain/YourPath/ad.pl?pos=Pos1&nos=1&dsp=dim&agn=AdGrp1&sel=rnd"
WIDTH="1"  HEIGHT="1" BORDER="0" ID="imgPos1">
<!-- Retrieve the ad value from the cookie --> 
<SCRIPT LANGUAGE="Javascript" TYPE="text/javascript">
  var dagPos1 = new DAG("Pos1") ;
  dagPos1.GetAdsFromCookie() ;
</script>
<!-- Here dagPos1 contains a single ad selected randomly from AdGrp1 group --> 

<!-- Define functions to load another ad from AdGrp1 during run time --> 
<SCRIPT LANGUAGE="Javascript" TYPE="text/javascript">
  var imgPos1 = getObjByID("imgPos1") ;
  function requestAd() {
    // Request the ad via cookie
    imgPos1.src = "" ;
    imgPos1.src = "http://YourDomain/YourPath/ad.pl?pos=Pos1&nos=1&dsp=dim&agn=AdGrp1&sel=rnd" ;
    // Since it will take time to load cookie, 
    // Set a timeout to retrieve the value of the cookie
    setTimeout("dagPos1.GetAdsFromCookie();", 5000) ;
  }
  // calling requestAd() function will load a new random ad from group AdGroup1
  // into object dagPos1, It is so easy!   
</script>

<!-- Show how to load an ad as a DAG class object directly during page load --> 
<!-- Load all ads of ad group AdGrp2 in to dagPos2 DAG class object --> 
<SCRIPT LANGUAGE="Javascript" TYPE="text/javascript"
  SRC="http://YourDomain/YourPath/ad.pl?pos=Pos2&dsp=djs&agn=AdGrp2&sel=all">
</script>
<!-- Here dagPos2 contains all the ads in the AdGrp2 group --> 

Global Variables and Functions

Global Functions and Variables Manual

These functions and variables are global and can be called/retrieved directly. They are helper functions that isolate many browser specific tasks from the user.

windWidth: Width of the usable client area.
windHeight: Height of the usable client area.
docXScroll: The amount of horizontal scrolling.
docYScroll: The amount of vertical scrolling.
MouseX: Current horizontal position of the mouse pointer
MouseY: Current vertical position of the mouse pointer
mouseEventHandler: Retrieve the current position of mouse pointer.
getObjByID: Find the object whose ID is given.
putContent: Change the html content of a given object.
parseCookie: Retrieve the cookies in an array as name-value pairs.
getCookieValue: Retrieve the value of the named cookie from the cookie array.
deleteCookie: Deletes the named cookie from the document cookies.
parseCookieValue: Parses the packed value of a cookie.

Global Event Handler (GEH) Class

Global Event Handler (GEH) Class Manual

Global Event Handler (GEH) class is deigned to solve a practical problem in JavaScript. If you want to assign more than one event handlers to a JavaScript event, there is a problem of resource sharing. With the GEH class, multiple event handler codes can be assigned to a single JavaScript event.

GEH: GEH Class.
GEH.NewHandler method: Add a new event handler code to the event associated with this GEH object.
GEH.RemoveHandler Method: Removes a previously installed event handler code to the event associated with this GEH object.
GEH.CallHandlers Method: Evaluates all of the installed event handler codes, once.
GEH.tasks Property: Container array for the event handler codes installed.

Pre-declared GEH Objects

API defines some pre-declared GEH objects that are associated to some JavaScript object events for the users convenience.

gehMMove GEH Object: Associated with document.onmousemove event.
gehResize GEH Object: Associated with window.onresize event.
gehScroll GEH Object: Associated with window.onscroll event.

Ad Class

Ad Class Manual

Ad Class is a container for a single ad or content. The properties of the class closely reflects the DynAds ad database fields in the server. When an ad group is loaded to the browser as a DAG object from DynAds database, all Ad objects are created automatically.

Ad Class: Container class for a single ad.
Ad.Html method: Get the html content of the ad (without link redirection).
Ad.RedHtml method: Get the redirected html content of the ad.
Ad.isAd Property: Check if this object is an Ad object.
Ad.category Property: Category of the Ad.
Ad.name Property: Name of the Ad.
Ad.hhtml Property: Header html of the Ad.
Ad.fhtml Property: Footer html of the Ad.
Ad.link Property: Original link of the Ad.
Ad.rlink Property: Redirection link of the Ad.
Ad.weight Property: Weight of the Ad.

Ad Group (AdGrp) Class

AdGrp Class Manual

AdGrp class is a class for handling and managing a group of ads or contents. When an ad group is loaded to the browser as a DAG object from DynAds database, all AdGrp objects are created automatically.

AdGrp Class: Class for managing multiple ads as a group.
AdGrp.NewAd Method: Create a new Ad object and append it to the internal ad list
AdGrp.RandIndex Method: Generates a random integer value between 0 and one less the number of ads in the object.
AdGrp.WRandIndex Method: Generates a weighted random integer value between 0 and one less the number of ads in the object.
AdGrp.RandAd Method: Selects one of the ads in the group randomly.
AdGrp.WRandAd Method: Selects one of the ads in the group weighted randomly.
AdGrp.isAdGrp Property: Check if this object is an AdGrp object. isAdGrp property is always true for an AdGrp object.
AdGrp.ads Property: Array of the ads in the group. Each element of the ads array is an Ad object.
AdGrp.length Property Number of ads in the AdGrp object.

Display Ad Group (DAG) Class

DAG Class Manual

DAG class is a class for displaying and manipulating an AdGrp object. DAG class includes a single AdGrp object and provides many display and manipulation methods and properties for that ad group. When the DAG object is loaded to the browser from DynAds server, the internal AdGrp object is created and initialized automatically.

DAG Class: Class for displaying and manipulating a group of ads.
DAG.GetAdsFromCookie Method: Load the ads of this DAG from the cookie set by DynAds server previously.
DAG.ReceiveAdCookie Method: Calls GetAdsFromCookie method until the cookie is retrieved.
DAG.ReqAdCookie Method: Request an Ad through cookie for on the fly ad retrieval from the DynAds server
DAG.WriteCCElem Method: Creates the IMG element for ad cookie requests.
DAG.WriteContainer Method: Write the container of the ads to the document.
DAG.Object Method: Get the container object of this DAG.
DAG.PutContent Method: Put the given content to this Display Group's container.
DAG.GetSelAd Method: Retrieves the html content of the specified ad in the ad group.
DAG.PutAd Method: Display an Ad in this Display Group's container.
DAG.PutAdPer Method: Periodically call PutAd method.
DAG.RefreshVisual Method: Update the visual properties of the container.
DAG.LeftPosition Method: Calculates the left position of the container of the DAG object.
DAG.TopPosition Method: Calculates the top position of the container of the DAG object.
DAG.RefreshPosition Method: Refreshe the position (left and top points) of the container.
DAG.RefreshPositionPer Method: Periodically refresh the position.
DAG.StopTimer Method: Stop the timer of a periodic event.
AG.AdBoxRefPoint Method: Determines the reference point on the ad container box.
DAG.WindAnchorPoint Method: Determines the anchor point to align the ad box.
DAG.ScrollCompensate Method: Determines scrolling compensation parameters.
DAG.ChangeAnchorPoint Method: Changes the anchor point and box reference point without changing the position of the ad box.

DAG.isDAG Property: isDAG property is always true for a DAG object.
DAG.name Property: Name of the display ad group.
DAG.ag Property: Underlying AdGrp object.
DAG.put_obj Property: Container Object of this dag.
DAG.put_period Property: Period of the periodic content put (PutAdPer method).
DAG.put_mode Property: The ad selection method.
DAG.put_head Property: put_head is prepended to the content of selected ad in PutAd method.
DAG.put_foot Property: put_head is appended to the content of selected ad in PutAd method.
DAG.put_lasti Property: Contains the index of the last put ad by the methods PutAd and PutAdPer.
DAG.timer Property: Timer IDs are set by periodic events, and used to stop that event later
DAG.left Property: Left position of the container.
DAG.top Property: Top position of the container.
DAG.width Property: Width of the container.
DAG.height Property: Height of the container.
DAG.visible Property: Hide or show the container.
DAG.sxr Property: sxr property is scrolling compensation parameter in horizontal direction.
DAG.syr Property: syr property is scrolling compensation parameter in vertical direction.
DAG.mxr Property: mxr property is mouse pointer alignment parameter in horizontal direction.
DAG.myr Property: myr property is mouse pointer alignment parameter in vertical direction.
DAG.wxr Property: wxr property is window width alignment parameter in horizontal direction.
DAG.wyr Property: wyr property is window height alignment parameter in vertical direction.
DAG.axr Property: axr property is container width alignment parameter in horizontal direction.
DAG.ayr Property: ayr property is container height alignment parameter in vertical direction.
DAG.xoff Property: xoff property is a horizontal position adjustment value.
DAG.yoff Property: yoff property is a vertical position adjustment value.
DAG.pos_period Property: pos_period is the period of position refreshments and used by RefreshPositionPer method.
DAG.pos_pause_refresh Property: If set to true, pos_pause_refresh pauses the refreshing of the position of the container.
DAG.cc_task Property: A string to be evaluated after each successful ad received through cookies.


Copyright © 2003, RobustHost.com. All Rights Reserved.