What parameter codes can I put in a 3rd party tracking and conversion tag?

  • Posts: 12
  • Thank you received: 0
10 months 3 weeks ago #352165

-- HikaShop version -- : 4.7.3
-- Joomla version -- : 4.2.8
-- PHP version -- : 8.0
-- Browser(s) name and version -- : Chrome

Hi all,

I'm using Hikashop on Joomla 4.
A 3rd affiliate service company issued 2 tags to put in our site,
tracking tag in all pages, conversion tag in checkout page,
and I have to put "Order ID" and "Order amount" parameter codes in conversion tag.

Tracking tag:

<script src="https://r.moshimo.com/af/r/maftag.js"></script>

Conversion tag:
<script src="https://r.moshimo.com/af/r/result.js?p_id=1234&pc_id=1234&m_v=【HERE WE NEED ORDER ID CODE】&p=【HERE WE NEED ORDER AMOUNT CODE】" id="msmaf"></script>
<noscript><img src="https://r.moshimo.com/af/r/result?p_id=1234&pc_id=1234&m_v=【HERE WE NEED ORDER ID CODE】&p=【HERE WE NEED ORDER AMOUNT CODE】" width="1" height="1" alt=""></noscript>
Question 1
What are the parameters for Hikashop?

Question 2
How can I add these tags in to all pages and checkout page?
Joomla users suggested us to use "Custom HTML module" way, it can apply to all pages theoretically but we are not sure if it's working after we tried. and how can we do it so only apply to a checkpage?

Thank you.

Tax

Last edit: 10 months 3 weeks ago by nicolas.

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 months 3 weeks ago #352166

Hi,

For the tracking tag, there are many ways to go about it.
You could add it directly in your template, you could use a custom HTML module, you could have a plugin inject it to the headers of the pages.
To check if your solution works, just look at the HTML of your pages and see if you get the tracking code in there:
blog.hubspot.com/website/how-to-inspect

For the conversion tag, you can't do it like that.
You need to add the code at the end of the checkout only.
This can be done with a view override of the view checkout / after_end and / or checkout / end in the menu Display>Views. Here is a thread where we talk about doing this:
www.hikashop.com/forum/integrations/9013...egration/326377.html You can also see there sample codes to get the order id and total amount in these view files.

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

  • Posts: 12
  • Thank you received: 0
10 months 3 weeks ago #352181

Hi Nicolas,

Thank you for your help.
I understand the logic.

For tracking tag, when I decide a "Position" for the custom html module,
the pages definitely can include the code I put, but at same time the code string itself is shown
on the pages so it's very weird for customers to see the internal code things....
if I don't give the module any position, of course it doesn't show in the public but the pages don't include the code.
A solution I thought is to let the module show somewhere in the pages then use css to make it invisible.
But is it a proper way?

For conversion tag, <?php echo $this->order->order_full_price;?> and <?php echo $this->order->order_id; ?>
are the correct parameters?
and yes I looked into "checkout / after_end and / and checkout / end",
but I don't know where to put the code inside, I thought there are <head><body> tags but I don't see them..
many tips suggest this kind of tag should be embedded in between <head></head> or similar,
but I'm not familiar with the code things...

Can you indicate where exactly I should put a conversion tag in the file below?
and is there any possibility that this modification might be deleted by Hikashop update?


<?php
/**
* @package HikaShop for Joomla!
* @version 4.7.1
* @author hikashop.com
* @copyright (C) 2010-2023 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );
if(!empty($this->url))
$app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$this->url));

$app = JFactory::getApplication();
$app->triggerEvent('onHikashopOrderTrackingDisplay', array($this->order));

Thank you very much!

Tax

Last edit: 10 months 3 weeks ago by tax.

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 months 3 weeks ago #352182

Hi,

1. You probably have that issue:
forum.joomla.org/viewtopic.php?t=486022

2. To add your script to the headers, you can do like explained here:
docs.joomla.org/Adding_JavaScript
If you're adding the script tags in the view without using the PHP on that link, then you can add it at the top of the view file.
If you're adding the script tags in the view using the PHP on that link, then you can add it at the bottom of the view file.

When you edit view files via the menu Display>Views, the changes are saved as template view overrides. So you won't lose them when you update HikaShop. You will "lose" them if you switch to another template, but then you can just copy the view file overrides from one template to the other.

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

  • Posts: 12
  • Thank you received: 0
10 months 3 weeks ago #352195

Hi Nicolas,

Thank you for your explicit guidance.

For 1, it seems solved now, when writing in the custom html module, should disable WYSIWYG, I understand.

For 2, I tried to put the tag in the bottom of the files (after_end&end) but it occurs an error, even can't finish customer's payment.
then I put the tag in the top of the files, then the payment can succeed but the 3rd party affiliate company's test doesn't see any result,
means can't have the conversion record. our site has Paypal and Stripe payment methods by the way.

Here is how I put the tag in the files (after_end&end), anything wrong?
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<script src="https://r.moshimo.com/af/r/result.js?p_id=1234&pc_id=1234&m_v=<?php echo $this->order->order_id; ?>&p=<?php echo $this->order->order_full_price;?>" id="msmaf"></script>
<noscript><img src="https://r.moshimo.com/af/r/result?p_id=1234&pc_id=1234&m_v=<?php echo $this->order->order_id; ?>&p=<?php echo $this->order->order_full_price;?>" width="1" height="1" alt=""></noscript>
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.7.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2023 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );
if(!empty($this->url))
	$app->enqueueMessage(JText::sprintf('YOU_CAN_NOW_ACCESS_YOUR_ORDER_HERE',$this->url));

$app = JFactory::getApplication();
$app->triggerEvent('onHikashopOrderTrackingDisplay', array($this->order));
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Thanks!

Last edit: 10 months 3 weeks ago by nicolas.

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 months 3 weeks ago #352197

Hi,

This code is fine as far as I can see. It might be the format of order_full_price which isn't ok ? Maybe you need to round it ?

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

  • Posts: 12
  • Thank you received: 0
10 months 3 weeks ago #352200

But the test conversion tracking is not recognized by the affiliate company.
what do you mean "Round it"?

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

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
10 months 3 weeks ago #352201

Hi,

I mean that maybe you should use this code instead:

<?php echo round($this->order->order_full_price,2);?>
The price being with too many decimals might lead to the conversion not working.
Also, make sure you do the view override for the template you're using on the frontend. If you do it for another template, then your changes will be ignored.

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

Time to create page: 0.068 seconds
Powered by Kunena Forum