Jump to content

Conversion tracking code, Where to put it exactly?


Recommended Posts

It looks like this. I would really appreciate if you could tell me where to put this one exactly  

 

<!-- Google Code for asasd Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 96748663;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "HnDtCMur3hgjkg2PzQM";
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/967051253/?label=HnDtCMjkljkl7Z2PzQM&guid=ON&script=0"/>
</div>
</noscript>
Edited by biox90 (see edit history)
Link to comment
Share on other sites

if i were you i will add this code:

$this->context->smarty->assign(array('order_created'=>1));

to .contorllers/front/orderConfirmationController.php

 

inside:

	public function initContent()
	{

funciton

 

 

then in theme file, for example header.tpl add this code:

 

{if isset($order_created)}
    {if $order_created==1}
<!-- Google Code for asasd Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 96748663;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "HnDtCMur3hgjkg2PzQM";
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/967051253/?label=HnDtCMjkljkl7Z2PzQM&guid=ON&script=0"/>
</div>
</noscript>
    {/if}
{/if}
Link to comment
Share on other sites

Thanks Vekia!

 

Will this be ok?

 

public function initContent()
{
$this->context->smarty->assign(array('order_created'=>1));
parent::initContent();
 
$this->context->smarty->assign(array(
'is_guest' => $this->context->customer->is_guest,
'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn()
......
 
??
Edited by biox90 (see edit history)
Link to comment
Share on other sites

you can use method you pasted above,

everything is allright there

Still not working, been waiting for 2 days and adwords says "not verified" in the conversion section?

Any clue why this is happening? 

Link to comment
Share on other sites

create test order, and on order confirmation page check if code you defined appears there 

to see page source press ctrl+U

I checked and it does show.

 

here is a little of the code that shows

 

var google_conversion_id = 967036653;   var google_conversion_language = "en";   var google_conversion_format = "2";   var google_conversion_color = "ffffff";   var google_conversion_label = "aQFuCJvt3wkQ7Z2PzQM";   var google_conversion_value = 1.000000;   var google_remarketing_only = false;   /* ]]> */   (function (i, s, o, g, r, a, m) {   i['GoogleAnalyticsObject'] = r;   i[r] = i[r] || function () {

 

What could be the problem?

Link to comment
Share on other sites

I would create a module and hook it to order confirmation. Get the variables you need from the php hook, and assign them to the template, where you will display js :) I did it countless time, always worked (with google's too)

Link to comment
Share on other sites

I checked and it does show.

 

here is a little of the code that shows

 

var google_conversion_id = 967036653;   var google_conversion_language = "en";   var google_conversion_format = "2";   var google_conversion_color = "ffffff";   var google_conversion_label = "aQFuCJvt3wkQ7Z2PzQM";   var google_conversion_value = 1.000000;   var google_remarketing_only = false;   /* ]]> */   (function (i, s, o, g, r, a, m) {   i['GoogleAnalyticsObject'] = r;   i[r] = i[r] || function () {

 

What could be the problem?

 

this is all what you've got? no <script> markup etc. ?

what ps version? 1.6.0.7 / 1.6.0.8 ?

Link to comment
Share on other sites

this is all what you've got? no <script> markup etc. ?

what ps version? 1.6.0.7 / 1.6.0.8 ?

Got version 1.6.0.7

 

Strange got no <script>, not showing the way i wrote it in the FTP file header.tpl

 

What could be wrong?

Link to comment
Share on other sites

check if purifier is enabled - if so - disable it

go to preferences > general (there is an option to manage HTML purifier)

 

what's going on then?

Thanks man, but it is already disabled :S

Link to comment
Share on other sites

×
×
  • Create New...