Adjunction js client | Documentation
Use this document as a way to quickly integrate Adjunction js client in your website.
Client-side JavaScript Integration
This integration method allows you to serve one or more ad units onto your page through a JavaScript snippet.
-
To get started, load our client-side library in the
<head>section of your page:<script async>document.write("<script type='text/javascript' src='https://ajjs.adjunction.co/library/ajjs.js?v=" + Date.now() + "'><\/script>");</script> -
In the
<body>section of your page, create an HTML element (e.g. DIV) with a unique ID for each placement you intend to serve.<div id="DIV_A"></div> <div id="DIV_B"></div> -
Instantiate a global ajjs object, create config object and push command (where you should set config, set keyword and execute) as shown below. Every ads units will be loaded into the appropriate DIV slots.
<script> window.ajjs = window.ajjs || {cmd: []}; const config = { slots: [ { id: "DIV_A", template: { params: { limit: 3, showImage: true, showRatingStars: true, showRatingReviews: true, showSiteLinks: true, siteLinksLimit: 2, btnText: "See It", showBtn: true, trackingClass: "mytrk" } } }, { id: "DIV_B", template: { params: { limit: 2, showImage: false, showRatingStars: true, showRatingReviews: true, showSiteLinks: true, siteLinksLimit: 1, btnText: "Click", showBtn: true, trackingClass: "mytrk" } } } ] }; ajjs.cmd.push(function () { ajjs .setConfig(config) .setKeyword("iphone") .execute() }); </script>
Slot template config params
| Field | Description | Possible Values | Default Value |
|---|---|---|---|
| limit | Number of advertisements in the slot | <integer>, range from 1 to 10 |
4 |
| showImage |
Show pictures in ads. |
<boolean> |
true |
| showRatingStars | Show rating stars on ads | <boolean> |
true |
| showRatingReviews | Show the number of reviews in ads | <boolean> |
true |
| showSiteLinks | Show site links | <boolean> |
true |
| siteLinksLimit | Number of site links in the ad | <integer>, range from 1 to 10 |
3 |
| showBtn | Show button | <boolean> |
true |
| btnText | Button text | <string>, example: "See It" |
"See It" |
| trackingClass | CSS class that will be added to every link in the slot | <string>, example: "mytrk" |
"trk" |