May 15, 2009

Integrating Webgains affiliate network with ASPDotNetStorefront

Filed under: Web Content Pages — Tags: , , — Webopius @ 12:10 pm

We are just completing some integration work to embed the Webgains affiliate network and tracking code into an online store built on the ASPDotNetStorefront platform (ASPDNSF).

Our UK ASPDotNetStorefront (ASPDNSF) Development and Support Services

Related external Sites of interest:

This post is intended to give developers the steps and code necessary to allow Webgains and ASPDotNetStorefront to work together using both the regular ASPDNSF checkout and Google Checkout paths. The techniques can also be used for other affiliate and conversion tracking systems.

Basic overview of the affiliate tracking process

  • A potential customer will browse an affiliated website containing links to you and click a link to your site
  • The link re-directs the customer through the affiliate tracking system which starts to track the customer (usually with a cookie) and then sends them to your site.
  • The Customer browses your site and hopefully will start the order process
  • Once they place a successful order, a final order confirmation page is displayed. This page contains a link using Javascript or a 1×1 pixel image that links back to the affiliate system.
  • The affiliate system is now able to record that a customer entered your site and made a purchase so commission due can be calculated.

ASPDotNetStorefront, Webgains and Google Checkout integration

Based on the above process you can see that the most important step is to track a successful order. Within ASPDNSF there is the standard checkout process, PayPal, Google Checkout etc. Each of these methods needs to be able to tell Webgains if a successful order is made.

Integrating Google Checkout with Webgains

The easiest first step to take when working with Webgains and ASPDNSF is to embed the affiliate tracking code into the GoogleCheckout process.

To do this, you will need to modify two AppConfig variables from within your admin pages:

  • GoogleCheckout.ConversionParameters
  • GoogleCheckout.ConversionURL

ASPDotNetStorefront Support and Development:

ASPDotNetStorefront support and development services

AppConfig GoogleCheckout.ConversionParameters field

This AppConfig field allows you to specify which Webgains fields you will be passing back to the affiliate network and how they map to the equivalent GoogleCheckout values.  The two most commonly used Webgains fields are wgOrderReference (the reference number for the order and a mandatory field) and wgValue (the total order value and mandatory if you pay commission based on percentage of order total).

The equivalent Google Checkout fields are: order-id and order-total. To map these fields, change the GoogleCheckout.ConversionParameters AppConfig field value to:

order-id wgorderreference,order-total wgvalue

As you can probably see, this states that the Google field ‘order-id’ will be given to ‘wgOrderReference’ and ‘order-total’ will be given to ‘wgvalue’.

Other common Webgains fields available for mapping are:

wgEventID – the commission type to use (based on your Webgains account under commission types)
wgComment – additional comment against this order (255 characters)
wgCustomerID – if you are paying based on repeat business, the customer id (equivalent GoogleCheckout field should be buyer-id)

AppConfig GoogleCheckout.ConversionURL field

This field specifies the Webgains tracking URL that GoogleCheckout will call once an order is complete. The usual format for this URL field is:

Where wgprogramid is the number of your program affiliate scheme in Webgains and wgeventid is the commission type number from your Webgains account. You can access these values from the Webgains admininstration console.

Having changed these two AppConfig fields, you should now be able to successfully test an affiliated purchase made through ASPDNSF using Google Checkout.

ASPDotNetStorefront, Webgains and Standard Checkout integration

To integrate the Webgains affiliate system into ASPDNSF, we need to modify the final order confirmation page. For most customers, the preference is to do this without modifying the source code. Luckily, the confirmation page uses an XML package (page.orderconfirmation.xml). We can hook into this XML package and generate an image link back to Webgains containing the order reference number and order total.

Here are the steps to follow:

Step 1. Copy page.orderconfirmation.xml from the XMLPackages directory to your site’s skin directory (usually skins/Skin_X/XmlPackages) where the X in Skin_X matches the default SkinID your site is using (1,2,3 etc).

This step isn’t strictly necessary but it’s good practice because when ASPDNSF is upgraded to the next release, you’ll have a copy of all the files you modified in the Skins directory making identifying changed files and migration between versions much simpler.

Step 2. Add webgains parameters to the page.orderconfirmation.xml package.

Now, edit the page.orderconfirmation.xml package you just copied and add the following lines of code just below the <xsl:param> section of this file:

<xsl:param name="WGValue"><xsl:value-of select="concat('wgvalue=',format-number(/root/Orders/Order/OrderSubtotal,'0.00'))"/></xsl:param>
<xsl:param name="WGProgramID"><xsl:value-of select="concat('wgprogramid=','YOURPROGID')"/></xsl:param>
<xsl:param name="WGEventID"><xsl:value-of select="concat('wgeventid=','YOUREVENTID')"/></xsl:param>
<xsl:param name="WGOrderID"><xsl:value-of select="concat('wgorderreference=',$OrderNumber)"/></xsl:param>
<xsl:param name="WebgainsImage">
<xsl:value-of select="concat('&lt;img src=&quot;;',$WGProgramID,'&amp;wgrs=1&amp;',$WGValue,'&amp;',$WGEventID,'&amp;',$WGOrderID,'&quot; alt=&quot;&quot; /&gt;')"/>

You should replace ‘YOURPROGID’ above with your Webgains program id (from Program Settings -> Technical in the Webgains admin system) and ‘YOUREVENTID’ with the commission ID number you wish to use (from Program Setup -> Commission Types in the Webgains admin system)

Step 3 Render the affiliate image link.

Now, continue to edit the page.orderconfirmation.xml page using the parameters you just created to render an image link back to webgains. Insert this line of code just before the closing </xsl:template> tag:

<xsl:value-of select="$WebgainsImage" disable-output-escaping="yes"/>

Save the file and test your order confirmation page. If all is working when you look at the source code of the page, you should see an image link back to Webgains containing the correct order value and order reference number.

  • Tags