HP Canon & Epson Ink, Lexmark, Brother Toner cartridge Printer Ink Cartridges News

Google Analytics - Revenue Tracking for Actinic v8 and v9

We have developed this code over a period of a couple of weeks, and are donating it free to any Actinic users who would like to enable Google E-Commerce tracking within Analytics.
Once this code is enabled the information that you can mine from Analytics is absolutely top notch.

I am willing to give you this code for nothing – but (there is always a but!) I want a decent link back from your site to me, there – not too painful was it?.
To make it easy I have listed five different links here and would ask you to look at your nearest printer and choose the relevant code for that manufacturer, if your printer is not listed, use the last one:

Got a HP Printer? Copy and insert on your page:

  1. <a href="http://www.stinkyinkshop.co.uk/acatalog/hp__Hewlett_Packard__inkjet_cartridges.html">
  2. HP Inkjet Cartridges
  3. </a>

Got an Epson Printer? Copy and insert on your page:

  1. <a href="http://www.stinkyinkshop.co.uk/acatalog/Epson_Inkjet_Cartridges.html">
  2. Epson Ink Cartridges
  3. </a>

Got a Canon Printer? Copy and insert on your page:

  1. <a href="http://www.stinkyinkshop.co.uk/acatalog/Canon_Printers_Inkjet_Cartridges.html">
  2. Canon Ink Cartridges
  3. </a>

Got a Lexmark Printer? Copy and insert on your page:

  1. <a href="http://www.stinkyinkshop.co.uk/acatalog/Lexmark_Inkjet_Supplies.html">
  2. Lexmark Ink
  3. </a>

Not Sure? Copy and insert on your page:

  1. <a href="http://www.stinkyinkshop.co.uk">
  2. Printer Ink
  3. </a>

On to the code…

This guide assumes you have already installed analytics on the rest of your site. If not, the article How do I add tracking code to my website? should help you out.

Enable e-commerce tracking

Enable E-Commerce Tracking in Analytics

Install the scripts

Download the main roi script from http://www.stinkyinkshop.co.uk/roi-example.js and rename it to roi.js make sure you adjust all the items in the OPTIONS section to match your own site.

Download jQuery from http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.min.js rename it to jquery.js

Place roi.js and jquery.js into your actinic ’site’ directory.

Set Actinic Page Type to ‘Receipt’

Set Actinic Page type to Receipt

Place the following changes into the section of ‘Receipt Page Layout’

  1.    <script language="javascript" type="text/javascript" src="jquery.js"></script>
  2.    <script language="javascript" type="text/javascript" src="roi.js"></script>

Wrap Actinic Variables with span tags.

The roi script needs a way of referencing each of the Actinic variables, we can do this by wrapping each of them with a span tag and giving them a class. This could easily work with another shopping cart system as long you have a way of accessing the receipt templates.

.receipt_order_id in ‘Receipt Order Number’ layout

The order number field in Actinic

  1.   <span class="receipt_order_id"><Actinic:Variable Name="TheOrderNumber"/></span>

.receipt_total in ‘Total Row’ layout

The total field in Actinic

  1.  <span class="receipt_total"><Actinic:Variable Name="Total"/></span>

.receipt_tax in ‘Tax 1 Row’ layout

The tax field in Actinic

  1.  <span class="receipt_tax"><Actinic:Variable Name="Tax1"/></span>

.receipt_shipping in ‘Shipping Charge Row’ layout

The shipping field in Actinic

  1.  <span class="receipt_shipping"><Actinic:Variable Name="Shipping"/></span>

.receipt_town & .receipt_county in ‘Receipt Invoice Address Details’ layout

The state field in Actinic

  1.  <span class="receipt_town"><Actinic:Variable Name="InvoiceAddress3"/></span>
  2.  <span class="receipt_county"><Actinic:Variable Name="InvoiceAddress4"/></span>

.receipt_line, .receipt_price in ‘Product Line Row’ layout

The .receipt_line class has to be added so the roi script can loop through each product row.

The product line table row in Actinic

  1. <tr class="receipt_line">
  2.    <td colspan="<Actinic:Variable Name="ProductColSpan"/>" class="cart">
  3.       <actinic:variable name="CartProductDetails" />
  4.    </td>
  5. <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPriceInCart%22%20%2f%3e" >
  6.    <td align="right" class="cart">
  7.       <span class="receipt_price"><Actinic:Variable Name="Price"/></span>
  8.    </td>
  9.    <td align="right" class="cart">
  10.       <Actinic:Variable Name="Cost"/>
  11.    </td>
  12. </actinic:block>
  13. </tr>

.receipt_reference, .receipt_name, .receipt_quantity in ‘Cart Product Details’ layout

The product line table row in Actinic

  1. <span class="receipt_reference"><Actinic:Variable Name="ProdRef"/></span>
  2.  
  3. <span class="receipt_name"><Actinic:Variable Name="ProductNameOnline"/></span>
  4.  
  5. <span class="receipt_quantity"><Actinic:Variable Name="Quantity"/></span>

.receipt_category & .receipt_country_code

If you have a way of setting .receipt_category & .receipt_country_code values they will be automatically used instead of the default variables set in the roi script.

All Done!

Update your site and wait 24 hours for Google to start showing your stats.

8 Responses to “Google Analytics - Revenue Tracking for Actinic v8 and v9”

  1. Actinic Plugins - Stinky Ink Says:

    [...] Implementing Google E-Commerce in Analytics [...]

  2. Derek Says:

    I’m probably being very dumb here but I simply cannot get this to work.
    I have changed everything in the Options as you suggest but I cannot for the life of me figure out what my product category is or what my shop is called in Google Analytics. I’ve tried various combinations and none work. Just where does Google hide these things on the analytics site?
    All the customisation of the receipt page is OK and all the scripts are where they should be. I’m now stumped but I presume the problem lies with the incorrect options.
    Any advice would be gratefully received.

  3. Rob Says:

    You can set the name of your shop and category to anything you want.

    i.e.

    // — OPTIONS —
    store_name = ‘ExoticAndOriental’;
    default_country_code = ‘UK’;
    default_category = ‘Gifts’;
    tracking_code = ‘UA-1234567-1′;

  4. Derek Says:

    Thanks for the swift response.
    I’ve now changed the roi.js as you have suggested with Exotic as the shop & oriental gifts as the category so it’s finger crossed!

  5. Derek Says:

    Sorry guys but it’s just not working. I’ll give it another 24 hours but I do not expect there to be any difference. Obviously I have got something wrong if this is working on your Actinic store so apologies for not being able to configure what would be an excellent revenue tracker.

  6. gabriel.crowe Says:

    I couldn’t get this working either.

    This is the preferred approach for me, and i’d love for it to have worked, but sadly, its throwing up all sorts of js errors.

    the errors center around this line in roi js:
    price = $(’.receipt_price’, this).text().replace(/[^0-9]/|>, ”);

    …the regex you use isnt valid.
    isnt this the correct regex?: /^[0-9]+$/

  7. gabriel.crowe Says:

    ..additionally, your script is missing and end curly brace.

  8. Rob Says:

    Wordpress is seriously messing with the code, so i’ve linked to it externally!

    Regarding the regex, I’m using the ^ to negate the expression so it’s inside the brackets (Delete everything but the numbers). I also only wanted it to strip the first alphanumeric character it come across. This is usually a pound sign which analytics doesn’t like very much :)

Leave a Reply

You must be logged in to post a comment.