Google Adwords

  • Posts: 4
  • Thank you received: 0
10 years 10 months ago #162657

-- url of the page with the problem -- : N/A
-- HikaShop version -- : 2.3.1
-- Joomla version -- : 3.3.1
-- PHP version -- : 5.4
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : N/A

Hello,

How can I place this google adwords code? The "var google_conversion_value" much change according to the product price.

<!-- Google Code -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1008879972;
var google_conversion_language = "es";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "dmuACJSH3R4Q5JKJ4QM";
var google_conversion_value = 25.000000;
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1008879972/?value=25.000000&amp;label=dmuACJSH3R4Q5JKJ4QM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

Thanks

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

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #162769

Hi,

I guess this needs to be in the product page, so you can edit the view "product / show_default" and add you code at the end of the view.

To have a dynamic conversion_value, you can use this code:

<!-- Google Code -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1008879972;
var google_conversion_language = "es";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "dmuACJSH3R4Q5JKJ4QM";
var google_conversion_value = <?php echo $this->element->prices[0]->price_value; ?>;
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1008879972/?value=<?php echo $this->element->prices[0]->price_value; ?>&amp;label=dmuACJSH3R4Q5JKJ4QM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

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

  • Posts: 4
  • Thank you received: 0
10 years 10 months ago #162849

Hello,

I actually needed to be in the "thank you page", since it is a tracking conversion code. My "After end" looks like this, since I also have a FB conversion code tracking. Notice that there isn't a "?>" closing tag by default (it was already like that), so I don't know if I should just paste the google adword code as it is.

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.3.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2014 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') );

$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
$js ="(function() {
  var _fbq = window._fbq || (window._fbq = []);
  if (!_fbq.loaded) {
    var fbds = document.createElement('script');
    fbds.async = true;
    fbds.src = '//connect.facebook.net/en_US/fbds.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(fbds, s);
    _fbq.loaded = true;
  }
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '6014693896236', {'value':'".round($order->order_full_price,2)."','currency':'USD'}]);";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);

Thanks.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #163278

Hi,

Yes so you can add the following code after the one for FB.

?>
<!-- Google Code -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1008879972;
var google_conversion_language = "es";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "dmuACJSH3R4Q5JKJ4QM";
var google_conversion_value = <?php echo round($order->order_full_price,2); ?>;
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1008879972/?value=<?php echo round($order->order_full_price,2); ?>&amp;label=dmuACJSH3R4Q5JKJ4QM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

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

  • Posts: 272
  • Thank you received: 7
10 years 7 months ago #175486

Hi Xavier,

I would like some help with adding Google Adwords conversion tracking code to 2 pages on my site. I have HS Essential, not Business, so cannot use the plugin you have and have to add the code manually.

I would like to add the code to the two following pages:
- The payment thank you page you get to after you pay using 'bank transfer'.
- A custom thank you page I have created on my site (Joomla article).

Can you offer advice where I go to add the code to both of these pages. My PHP knowledge is very bad so any help greatly appreciated.

Thank you in advance

Thank you

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

  • Posts: 83859
  • Thank you received: 13577
  • MODERATOR
10 years 7 months ago #175490

So the full that you need is this one (with modifications of your google adwords data):

<?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );

$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
?>
<!-- Google Code -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1008879972;
var google_conversion_language = "es";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "dmuACJSH3R4Q5JKJ4QM";
var google_conversion_value = <?php echo round($order->order_full_price,2); ?>;
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1008879972/?value=<?php echo round($order->order_full_price,2); ?>&amp;label=dmuACJSH3R4Q5JKJ4QM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
You can add it in the file plugins/hikashoppayment/banktransfer/banktransfer_end.php in order to have it for the thank you page of the bank transfer payment method.
For your Joomla article, you'll need to use a plugin like sourcerer in order to add the code in a Joomla article.
If you need someone with more experience in PHP to do that for you, you can contact our partners for a quote:
www.hikashop.com/home/our-partners.html

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

  • Posts: 272
  • Thank you received: 7
10 years 7 months ago #175665

Nicolas,
As always, your reply has been appreciated. Thank you.

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

  • Posts: 272
  • Thank you received: 7
10 years 7 months ago #175859

Hi Nicolas,

In the file 'plugins/hikashoppayment/banktransfer/banktransfer_end.php' do I need to add this code below that you listed? I was just going to add the code that Google gave me.

<?php
$app = JFactory::getApplication();
$app->enqueueMessage( JText::_('THANK_YOU_FOR_PURCHASE') );

$app = JFactory::getApplication();
$order_id = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id,false,false);
?>

Last edit: 10 years 7 months ago by Jerome. Reason: [code] is nice !!

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

  • Posts: 272
  • Thank you received: 7
10 years 7 months ago #175862

So you better understand, in the file 'plugins/hikashoppayment/banktransfer/banktransfer_end.php' I have the following code below. At the very bottom of that I was going to add the Google code...

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.3.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="hikashop_banktransfer_end" id="hikashop_banktransfer_end">
	<span class="hikashop_banktransfer_end_message" id="hikashop_banktransfer_end_message">
		<?php echo JText::_('ORDER_IS_COMPLETE').'<br/>'.
		JText::sprintf('PLEASE_TRANSFERT_MONEY',$this->amount).'<br/>'.
		$this->information.'<br/>'.
		JText::sprintf('INCLUDE_ORDER_NUMBER_TO_TRANSFER',$this->order_number).'<br/>'.
		JText::_('THANK_YOU_FOR_PURCHASE');?>
	</span>
</div>
<?php
if(!empty($this->return_url)){
	$doc = JFactory::getDocument();
	$doc->addScriptDeclaration("do_nothing( function() {window.location='".$this->return_url."'});");
}

Last edit: 10 years 7 months ago by Jerome. Reason: [code] is nice !!

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

  • Posts: 26240
  • Thank you received: 4036
  • MODERATOR
10 years 7 months ago #175877

Hi,

When you post code, please use the "code" tag.

I do not see any custom code in your view ; please do not post code of views that are directly in HikaShop ; don't worry we also have access to the source code of the views.

What is your question ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 272
  • Thank you received: 7
10 years 7 months ago #175946

Apologies Jerome. I will use the code tags from now on.

I will replace the code in the file 'plugins/hikashoppayment/banktransfer/banktransfer_end.php' with the following below. Can you please tell me if that is correct?

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.3.3
 * @author	hikashop.com
 * @copyright	(C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div class="hikashop_banktransfer_end" id="hikashop_banktransfer_end">
	<span class="hikashop_banktransfer_end_message" id="hikashop_banktransfer_end_message">
		<?php echo JText::_('ORDER_IS_COMPLETE').'<br/>'.
		JText::sprintf('PLEASE_TRANSFERT_MONEY',$this->amount).'<br/>'.
		$this->information.'<br/>'.
		JText::sprintf('INCLUDE_ORDER_NUMBER_TO_TRANSFER',$this->order_number).'<br/>'.
		JText::_('THANK_YOU_FOR_PURCHASE');?>
	</span>
</div>
<?php
if(!empty($this->return_url)){
	$doc = JFactory::getDocument();
	$doc->addScriptDeclaration("do_nothing( function() {window.location='".$this->return_url."'});");
}
?>
<!-- Google Code for Adwords sale tracking Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = XXXXXXXXXXXX;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "XXXXXXXXXXXX";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/XXXXXXXXXXX/?label=7ORjCKj95FYQ-Y2p3gM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

Last edit: 10 years 7 months ago by boopoo.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #175948

Hi,

Yes it seems to be correct.

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

Time to create page: 0.100 seconds
Powered by Kunena Forum