Tracking Pixel (CJ) get cart values

  • Posts: 57
  • Thank you received: 0
12 years 1 month ago #68067

I would like to place a conversion pixel of a tracking system in my hikashop site, I have to payment methods. First Data, and standard Paypal. Where can I place the tracking pixel that will have access to values no matter which payment method was used to pay. Values I would need are: total price (and sub total price), Quantity, order id or order number.

Thank you in advance.

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 1 month ago #68167

Hi,

Here are some information regarding tracking of sales:
www.hikashop.com/en/support/forum/4-how-...omfirmaion-page.html
www.hikashop.com/en/support/forum/4-how-...tracking-system.html

The place where to put the modifications will depend on your payment method, either in the file "after_end" or the file "end" of the view "checkout" via the menu Display->Views.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 1 month ago #68249

Thank you for the links, can you help me with telling me which files I have to edit for FirstData and Paypal?
I see views/checkout/tmpl

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 1 month ago #68443

You should edit the file as I said via the menu Display->Views and not via FTP. It's the file "after_end" of the view "checkout" that you need to edit.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 1 month ago #68687

Thank you for your response: is there a way to get the total order price without tax?

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 1 month ago #68836

Yes, you can do like that:

$app =& JFactory::getApplication();
$order_id = $app->getUserState(HIKASHOP_COMPONENT.'.order_id');
$orderClass = hikashop::get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
$tax = $order->order_subtotal - $order->order_subtotal_no_vat + $order->order_discount_tax + $order->order_shipping_tax;
echo $order->order_full_price - $tax;

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 1 month ago #69839

Thank you,

I tried the code above but it is not working for me. I have a php script (the second pixel you see), that puts the querystring in a text file, however nothing is showing up. I have had two conversions since i added the code and the pixel or url was not even called. I am assuming there may be an error in the code perhaps.


after_end.php
<?php
$app =& JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );
$order_id = $app->getUserState(HIKASHOP_COMPONENT.'.order_id');
$orderClass = hikashop::get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
$tax = $order->order_subtotal - $order->order_subtotal_no_vat + $order->order_discount_tax + $order->order_shipping_tax;
echo '<iframe src=" www.emjcd.com/tags/c?containerTagId=1153...54760&AMT1='.$order- >order_full_price - $tax.'&QTY1=1&ITEM1=Lead&CURRENCY=USD" height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>';
echo '<iframe src=" pixel.rockstaran.com/?pixel=OrderID_'.$o..._id.'_AMT1_'.$order- >order_full_price - $tax.'" height="1" width="1" frameborder="0" scrolling="no"></iframe>';


end.php
$app =& JFactory::getApplication();
$order_id = $app->getUserState(HIKASHOP_COMPONENT.'.order_id');
$orderClass = hikashop::get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
$tax = $order->order_subtotal - $order->order_subtotal_no_vat + $order->order_discount_tax + $order->order_shipping_tax;
echo '<iframe src=" www.emjcd.com/tags/c?containerTagId=1153...54760&AMT1='.$order- >order_full_price - $tax.'&QTY1=1&ITEM1=Lead&CURRENCY=USD" height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>';
echo '<iframe src=" pixel.rockstaran.com/?pixel=OrderID_'.$o..._id.'_AMT1_'.$order- >order_full_price - $tax.'" height="1" width="1" frameborder="0" scrolling="no"></iframe>';

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 1 month ago #69970

rockstaran wrote: Thank you,

I tried the code above but it is not working for me. I have a php script (the second pixel you see), that puts the querystring in a text file, however nothing is showing up. I have had two conversions since i added the code and the pixel or url was not even called. I am assuming there may be an error in the code perhaps.


after_end.php
<?php
$app =& JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );
$order_id = $app->getUserState(HIKASHOP_COMPONENT.'.order_id');
$orderClass = hikashop::get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
$tax = $order->order_subtotal - $order->order_subtotal_no_vat + $order->order_discount_tax + $order->order_shipping_tax;
echo '<iframe src=" www.emjcd.com/tags/c?containerTagId=1153...54760&AMT1='.$order- >order_full_price - $tax.'&QTY1=1&ITEM1=Lead&CURRENCY=USD" height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>';
echo '<iframe src=" pixel.rockstaran.com/?pixel=OrderID_'.$o..._id.'_AMT1_'.$order- >order_full_price - $tax.'" height="1" width="1" frameborder="0" scrolling="no"></iframe>';


end.php
$app =& JFactory::getApplication();
$order_id = $app->getUserState(HIKASHOP_COMPONENT.'.order_id');
$orderClass = hikashop::get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
$tax = $order->order_subtotal - $order->order_subtotal_no_vat + $order->order_discount_tax + $order->order_shipping_tax;
echo '<iframe src=" www.emjcd.com/tags/c?containerTagId=1153...54760&AMT1='.$order- >order_full_price - $tax.'&QTY1=1&ITEM1=Lead&CURRENCY=USD" height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>';
echo '<iframe src=" pixel.rockstaran.com/?pixel=OrderID_'.$o..._id.'_AMT1_'.$order- >order_full_price - $tax.'" height="1" width="1" frameborder="0" scrolling="no"></iframe>';


Any ideas on the above?^

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 1 month ago #70119

If the URL is not called, it means that you're not editing the correct file.

If you're editing them via the menu Display->Views, there are one view file per template, so make sure that you're editing the view file for the correct template.
Also, you can check the source of the end page to see if you see your HTML.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 1 month ago #70151

Thank you for the response.
I confirmed that I am editing the correct two files via Display>Views, previously I had the code (that did not use tax) and it work functioning, when I updated the same view files the url's are not being called.

Is there a way to get to the end page without having to go through the checkout process?

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 4 weeks ago #70267

No you have to go through the checkout process.

If you're updating the correct file, then what is the HTML generated by that code ? Did you check it via the source of the page ?

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 4 weeks ago #70281

I have only edited two files (end and after_end, of checkout view, in my template). They worked when I had the previous code (with tax included), but when I changed it to the code without tax it does not work, so for sure I am editing the correct file. I was trying to stay away from having to place an order, but will get it done today to see what the source code shows.

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 4 weeks ago #70509

Also, when you do, you should set the "error reporting" option of the joomla configuration to maximum so that you can is if you have some errors in the code.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 4 weeks ago #70807

I failed to turn on error reporting however I did put in an order.



-3.5527136788005E-15&QTY1=1&ITEM1=Lead&CURRENCY=USD" height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>

-3.5527136788005E-15" height="1" width="1" frameborder="0" scrolling="no"></iframe></div>


A review of the back end code:
echo '<iframe src=" www.emjcd.com/tags/c?containerTagId=1153...54760&AMT1='.$order- >order_full_price - $tax.'&QTY1=1&ITEM1=Lead&CURRENCY=USD" height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>';

echo '<iframe src=" pixel.rockstaran.com/?pixel=OrderID_'.$o..._id.'_AMT1_'.$order- >order_full_price - $tax.'" height="1" width="1" frameborder="0" scrolling="no"></iframe>';

Looks like something is breaking the string right before the tax variable or after. I think there is a problem in the math $order->order_full_price - $tax

Last edit: 12 years 4 weeks ago by rockstaran.

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 4 weeks ago #70808

try to replace :
$order->order_full_price - $tax

by:

round($order->order_full_price - $tax,2)

in your code.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 4 weeks ago #70810

It looks like it worked! however in this order there was no tax, hopefully when there is tax, it should still work fine.


<iframe src=" www.emjcd.com/tags/c?containerTagId=1153...M1=Lead&CURRENCY=USD " height="1" width="1" frameborder="0" scrolling="no" name="Conversion tag"></iframe>

<iframe src=" pixel.rockstaran.com/?pixel=OrderID_290_AMT1_40.17 " height="1" width="1" frameborder="0" scrolling="no"></iframe>

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
12 years 3 weeks ago #71663

Sorry for continuing on this topic, but one last question. What is the variable name or how can I subtract the shipping charge from the total that gets placed on the pixel?

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
12 years 3 weeks ago #71987

The shipping charge is accessible with: $order->order_shipping_price

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 0
11 years 11 months ago #80441

Now if I am doing this with Authorize.net Payment Method, how can I go about it? (being able to put a pixel that will have the total price like discussed in this thread).

Considering how you have to put a return URL, I dont know how we can grab those values.

Thank you for the help on this.

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13360
  • MODERATOR
11 years 11 months ago #80524

It depends.
In SIM mode, it's also the after_end file so it should already work.
In AIM mode, it's the file "end". But you will have to add an "if" condition around your code so that you only do it for the authorize.net payment method. Otherwise, it would add the tracking pixel for paypal and firstdata before the payment has been made.
It should be something like that:
if($order->order_payment_method=='authorize'){
//display the tracking pixel
}

Please Log in or Create an account to join the conversation.

Time to create page: 0.089 seconds
Powered by Kunena Forum