Templates Guide

Join the forum discussion on this post - (1) Posts

Once you have installed your copy of wpCJ, activated your license and configured the plugin, you are ready to begin promoting products/links and start earning money with Commission Junction.

There are, however, three requirements that must be fullfilled in order to effectively promote a creative using wpCJ:

  • You should have at least one working template.
  • You must have at least one populated and well defined zone.
  • You must be displaying that zone somewhere in your site.

In this guide I will try to explain the fundamentals of wpCJ Templates.

A wpCJ template is a set of HTML tags that defines the way a certain zone will be shown.

Every template has two parts:

  1. An Ad Unit code: This is the code that is used to show ONE and only ONE Ad Unit, no matter if the zone will be displaying several ad units at once. Every ad unit will share the same code… and this is that code. Imagine the classic layout of 2×2 positions of 125×125 pixels each position.Well, each position (or “Ad Unit”) will share the same code, that could be something like this:
    1
    
    <img src="imageX.jpg" alt="" width="125" height="125" />

    In this field, you must enter the code that will be shared among the Ad Units.

  2. A Canvas code: This is code that will be around the Ad Units.  It must contain the pseudo-tag:

    [AD_CANVAS:#]


    …in order to tell wpCJ where it should insert the Ad Unit Code.Using the same example of the classic layout of 2×2 positions of 125×125 pixels each position, we could specify a canvas code as the following:

    1
    2
    
    <div style="width: 280px;">
    [AD_CANVAS:4]</div>

    As you can see, we have changed the numeral by 4, to tell wpCJ that this pseudo-tag must be replaced by 4 Ad Units.

In the previous example, we used a static representation of an creative, however, it won’t make sense in any scenario so let’s see how we can make wpCJ to deal with the ad aunits.

There is a set of “shortcodes” that can be used in this stage that will be replaced once the template is rendered with products and/or links. Those shortcodes are:

Shortcode Meaning Available in:
[AD_IMAGE] URL of the ad unit image (if apply). Only in images
[AD_NAME] Name of the creative. P and L
[AD_URL] Destination (final URL) of the ad unit. P and L
[AD_DESC] Description of the product/link offered.
P and L
[AD_CODE] Original html code provided by CJ.com. P and L
[AD_JSCODE] Original javascript code provided by CJ.com (does not apply in link units). Only P
[AD_PRICE] Price of the product. Only P
[AD_CJCOUNTER] The impression counter image used by CJ.com.
P and L
[AD_ADVERTISER] It returns the Advertiser of a certain advert.
P and L
[AD_MANUFACTURER] It returns the manufacturer of the product being promoted.
Only P
[AD_MANUFACTURER_SKU] It returns the SKU used by the manufacturer.
Only P
[AD_SKU] It returns the SKU used by CJ.com
Only P
[AD_UPC] It returns the UPC used by CJ.com. Only P
[AD_ISBN] If the product is a registered publication, it returns its ISBN. Only Books
[AD_HEIGHT] If the creative has an image, it returns the height in pixels. Only in images
[AD_WIDTH] If the creative has an image, it returns the width in pixels. Only in images
[AD_CATEGORY] It returns the category under which CJ.com has the creative listed. P and L
[AD_PROMO_TYPE] It returns the type of creative that is being promoted. P and L
[AD_PROMO_START] It returns the date in which the promotion begins, if apply. P and L
[AD_PROMO_END] It returns the date in which the promotion ends, if apply. P and L

That said, now we can create a meaningful Ad Units code.

For instance, let’s complete the classic layout of 2×2 positions of 125×125 pixels each position:

Ad Unit Code:

1
2
3
4
<div style="overflow: hidden; float: left; height: 126px; width: 126px;">
<a title="[AD_NAME]" href="[AD_URL]">
<img title="[AD_NAME]" src="[AD_URL]" alt="Image of [AD_NAME]" width="[AD_WIDTH]" height="[AD_HEIGHT]" />
</a></div>

Canvas Code:

1
2
<div style="overflow: hidden; height: 280px; width: 280px;">
[AD_CANVAS:4]</div>

However, if you don’t want to deal with any code, you can simply create the most simple template that can be used  which is, however, useful as a full-product template:

Ad Unit Code:

1
[AD_CODE]

Canvas Code:

1
[AD_CANVAS:1]

These are the basics to begin the creation of templates for wpCJ. You are free to use any HTML/Javascript/jQuery code on it.

On thing you must remember: Every template must have an unique name.

  1. mansolo says:

    Any short code for the “saleprice” which would be useful?

    • Will says:

      Hello,

      Price and SalePrice short codes have been two fields in which we have been working on.

      The problem is that many of the products promoted by CJ.com do not have any SalePrice at all… So if we add a SalePrice short code (which we had done in the past and then derogated) you won’t have a reliable way to use it in your templates because you may be showing your visitors something like “Sale Price: $0 – Our Price: $9.99″.

      The best approach we have found is to create a general template to handle prices so the user can include some sort of intelligence into the process. Something like: If the product has SalePrice, use Price Template A. Otherwise, use Price Template B.

      Any suggestion on this regard?

      • mansolo says:

        Hi Will,

        Why not, if price=$0 then N/A.

        The 2 template approach could work for a single product but not for multiple products unless you mean 2 templates within the main template?

        Mansolo

  2. Will says:

    The 2 templates was thought to be a sort of general template that would apply for all products. And it would be used by adding a third shortcode, something like [AD_MYPRICE].

    So instead of using [AD_PRICE] or [AD_SALEPRICE], the user could use [AD_MYPRICE] and wpCJ will return the result of the basic algorithm that the user specified in the 2 templates mentioned above.

    I don’t like the N/A approach because you don’t see anything like that in serious sites. They show the sale price, or the sale price plus the reduced price… but never a Not/Assigned price.

    What do you think about it?

line
Our sitemap | Terms of service | Privacy guidelines (c) 2009 - wpCJ.com. All rights reserved
Commission Junction and its logo are trademarks of Commission Junction, Inc. WordPress and its logo are trademarks of Automattic, Inc.