Kod konwersji e-commerce prestashop 1.6. gdzie dodać


Why did you set up google_conversion_value to 0 ?

Google’s suggested php implementation looks like this:

<!-- Kod Google na stronę konwersji zakupowej -->
	var google_conversion_id = 1234567890;
	var google_conversion_language = "pl_PL";
	var google_conversion_format = "1";
	var google_conversion_color = "666666";
	var google_conversion_label = "xxx-XXx1xXXX123X1xX";
	var google_conversion_value = 10;                                 //strike through!
	if ( echo $totalValue ?>) {                                     //bold!
		var google_conversion_value =  echo $totalValue ?>      //bold!
		var google_conversion_currency =  echo $currency ?>     //bold!
	}                                                                 //bold!
	var google_conversion_currency = "PLN";                           //strike through!
	/* ]]> */ 
	<img height=1 width=1 border=0
	<? echo $totalValue ?>&conversion_currency=<? echo $currency ?>

but everyone should base on code given to them by google adwords, and then cut out lines which are struck through, and implement proper variables in places which are bold.

EDIT: Sorry, I realised that strike-through and bold formatting doesn’t work inside code field. It is hard to repair this, so i commented lines :<<


On prestashop 1.6 modifications should look like this (for example; works for me):


1. In controllers/front/OrderConfirmationController find:

public function initContent()

			'is_guest' => $this->context->customer->is_guest,
			'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
			'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn()

and change to:

public function initContent()

        $order = new Order($this->id_order);
        $currency = new Currency($order->id_currency);

			'is_guest' => $this->context->customer->is_guest,
			'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
			'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn(),
                        'name_of_cart_value_variable' => $order->getOrdersTotalPaid(),   // name_of_cart_value_variable
                        'name_of_currency_variable' => $currency->sign                   // name_of_currency_variable

2. Then navigate to themes/YOUR_THEME/order-confirmation.tpl, and after the last {/if} add:

    var google_conversion_id = 1234567890;     //your conversion id given by google!
    var google_conversion_language = "pl_PL";  //for example. You could put your language sign, or create another variable responsible for this.
    var google_conversion_format = "1";        //for example
    var google_conversion_color = "666666";    //example as well
    var google_conversion_label = "xxx-XXx1xXXX123X1xX"; //your label given by google!
    if ( {/literal}{$name_of_cart_value_variable}{literal} ) {
        var google_conversion_value =  "{/literal}{$name_of_cart_value_variable}{literal}"
        var google_conversion_currency =  "{/literal}{$name_of_currency_variable}{literal}"
    }                                          //careful in above lines 
    var google_remarketing_only = false;       //for example
    /* ]]> */

 type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">

style=display:inline;> height=„1” width=„1” style=borderstyle:none; alt=„” src=„//www.googleadservices.com/pagead/conversion/953948678/?value={$name_of_cart_value_variable}&conversion_currency={$name_of_currency_variable}&label=Zakup&script=0”/> //the last two variables here



You could customize other values send to google adwords, then you should retrieve them in controller. You got the vibe.


EDIT: Sorry for poor formatting, it’s hard to get rid of code blocks once they had been added.



Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Wyloguj / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj / Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj / Zmień )

Zdjęcie na Google+

Komentujesz korzystając z konta Google+. Wyloguj / Zmień )

Connecting to %s