Page 1 of 1

ClickTracks Revenue Tracking - what is the Subtotal var ?

Posted: Mon Nov 10, 2008 5:57 pm
by daviddavis
I am trying to implement clicktracks revenue tracking in Able Commerce.
I am told that this is the correct code by clicktracks but what is the correct AC Subtotal variable the correct syntax to insert it?

Here is what I have but it doesn't appear to be working-

Code: Select all

  <script type="text/javascript">
window.CT_C_OrderTotal='Subtotal';
  </script>
What should 'Subtotal' look like?

Thank you for your help!
-David Davis
http://www.TrainSignal.com

Re: ClickTracks Revenue Tracking - what is the Subtotal var ?

Posted: Tue Nov 11, 2008 8:02 am
by mazhar
For this you need to create a user control and build this javascript dynamically so that you can put the order total in it. Create a file ClickTracks.ascx in the ConLib and put the following contents in it.

Code: Select all

<%@ Control Language="C#" ClassName="ClickTracks" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        Order order = OrderDataSource.Load(PageHelper.GetOrderId());
        
        if (order != null)
        {
            string javaScript = string.Empty;
            javaScript += "window.CT_C_OrderTotal='"+order.TotalCharges.ToString()+"';";
            Page.RegisterClientScriptBlock("ClickTrackingScript", javaScript);
        }
    }
</script>
Now you can use this on for example the RecieptPage where you do have an order id.

Re: ClickTracks Revenue Tracking - what is the Subtotal var ?

Posted: Thu Nov 13, 2008 4:03 pm
by daviddavis
Hi Mazhar,
I really appreciate your help!
I have done as you recommended but am now just getting the order subtotal displayed as some text on the screen at checkout.
I found out that the code we put in the control library is dependant on the following clicktracks code. Thus, I suspect that it ALL needs to be in a conlib TOGETHER.
Can you tell me what the conlibrary would look like?

Thank you again for your help!

(note: the clicktracks conlibrary contains only the code you recommended in your post)

Code: Select all

<!-- ClickTracks Tracking -->
        [[Conlib:Custom/clicktracks]]
<script type="text/javascript">
                document.write('<'
                                + 'script type="text/javascript" src="'
                                + document.location.protocol
                                + '//stats4.clicktracks.com/cgi-bin/ctasp-server.cgi'
                                + '?i=VN5lHM5WODbdoT'
                                + '&c='+escape(document.cookie)
                                + '&fp=.trainsignal.com'
                                + '"></'+'script>');
</script><noscript><img src="https://stats4.clicktracks.com/cgi-bin/ctasp-server.cgi?i=VN5lHM5WODbdoT&g=1" alt="Web Analytics" border=0></noscript>