ClickTracks Revenue Tracking - what is the Subtotal var ?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
daviddavis
Ensign (ENS)
Ensign (ENS)
Posts: 10
Joined: Wed Sep 03, 2008 7:03 am

ClickTracks Revenue Tracking - what is the Subtotal var ?

Post by daviddavis » Mon Nov 10, 2008 5:57 pm

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

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

Post by mazhar » Tue Nov 11, 2008 8:02 am

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.

daviddavis
Ensign (ENS)
Ensign (ENS)
Posts: 10
Joined: Wed Sep 03, 2008 7:03 am

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

Post by daviddavis » Thu Nov 13, 2008 4:03 pm

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>

Post Reply