I assume nobody has worked out how to insert the corresponding category into the tracking code (rather than hardcoding the word "Product")?
Hi,philbydevil wrote:Try this xml for 1.5.4.1:
i think this topic is really useful for Opencarter who uses Google Analytics/Merchant/Adwords.
This vqmod seems a right alternative to the mod "google analytics expert", am I right?
What's precisely this mod for?
i've read
"passes the value of the transaction and the order details to the GA servers."
My end is to have Tracked the conversion of completed purchases.
And i don't want a fixed "Conversion Value" field , as suggested by the Google guide.
It would be great if these values ($TotalValue) of the orders can be displayed in Analytics and Adwords (already linked to Merchant).
Can this vqmod do this yet?
Thanks in advance
Hi, I am wonder as well how to include category ...storm-cloud wrote:Just wondering if anyone has worked out how to include the product category variable?
I assume an extra database query needs to be included but I can't quite work this out...
Edit: JhauraW, I have just noticed that you removed the Google Analytics Account ID from the script. This is actually required for the tracking to work correctly.
Phenomenal work, Philbydevil!philbydevil wrote:Try this xml for 1.5.4.1:You may have to change this line of code:The * may need to be changed to your theme name, but I think that * means ALL themes....Code: Select all
<file name="catalog/view/theme/*/template/common/success.tpl">
But, somehow I'm getting error when trying to access a variable's value. For instance, if I just try
Code: Select all
<?php echo $orderDetails['total'];?>
Any idea on where I might be going wrong?Undefined variable: orderDetails in <b>/home/.../template/common/success.tpl</b> on line <b>43</b>
Anyone?
WIP Design Publicidade e Marketing Digital
just guessing here but maybe put single quotes around it?
'<?php echo $orderDetails['total']; ?>'
'<?php echo $orderDetails['total']; ?>'
Simply means that you not setting the variable $orderDetails inside the controller.Ed_Rolla wrote:Phenomenal work, Philbydevil!philbydevil wrote:Try this xml for 1.5.4.1:You may have to change this line of code:The * may need to be changed to your theme name, but I think that * means ALL themes....Code: Select all
<file name="catalog/view/theme/*/template/common/success.tpl">
But, somehow I'm getting error when trying to access a variable's value. For instance, if I just tryI get the error message:Code: Select all
<?php echo $orderDetails['total'];?>
Any idea on where I might be going wrong?Undefined variable: orderDetails in <b>/home/.../template/common/success.tpl</b> on line <b>43</b>
Anyone?
Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.
Would ANYONE know how to call on the category for the tracking code?
Rather than hardcoding the word "Product", it really would be much better to have the category available in analytics. This way it is possible to filter out categories to see which are performing better than others.
I have been trying all night without success. I have outlined the steps below which I have have taken but my coding ability is not quite up to the task so I know that this is not correct.
1) In catalog/model/checkout/order.php add code to query the database to obtain the product category. This is the code I have tried to use but I am not sure if this is correct.
2) In catalog/controller/checkout/success.php add a line of code to set where the category information is being called from. This is the code I have added but I have a feeling that this is not correct.
3) Modify the tracking code to insert the category. What to change this to?
I am happy to make a donation (am I allowed to say this?) if anyone can help!
Rather than hardcoding the word "Product", it really would be much better to have the category available in analytics. This way it is possible to filter out categories to see which are performing better than others.
I have been trying all night without success. I have outlined the steps below which I have have taken but my coding ability is not quite up to the task so I know that this is not correct.
1) In catalog/model/checkout/order.php add code to query the database to obtain the product category. This is the code I have tried to use but I am not sure if this is correct.
Code: Select all
public function getOrderCategory($product_id)
{
$query = $this->db->query("SELECT " . DB_PREFIX . "category_description.name " . "FROM " . DB_PREFIX . "category_description LEFT JOIN " . DB_PREFIX . "product_to_category ON " . DB_PREFIX . "product_to_category.category_id = " . DB_PREFIX . "category_description.category_id " . "WHERE " . DB_PREFIX . "product_to_category.product_id = '" . (int)$product_id ."'");
if (isset($query->row['name'])) {
return $query->row['name'];
} else {
return 'Uncategorised';
}
}
Code: Select all
$this->data['orderCategory'] = $this->model_checkout_order->getOrderCategory($this->session->data['product_id']);
Code: Select all
'<?php echo json_encode('Products'); ?>'
i am working on it on an OC 1.5.1.3
i got it working (the original vq mod)
added some staff ( google adwords convertion tracking )
so far so good.
after that i tried adding category.
i managed to read the first category name (ex. if a product have 3 categories it will always read the first delivered from my query. )
but now somehow the order is not showing to analytics page :p
i will stick to it , and will post code etc.
i got it working (the original vq mod)
added some staff ( google adwords convertion tracking )
so far so good.
after that i tried adding category.
i managed to read the first category name (ex. if a product have 3 categories it will always read the first delivered from my query. )
but now somehow the order is not showing to analytics page :p
i will stick to it , and will post code etc.
in return of my previews commend.
i made some modifications in the script for oc 1.5.1.3 so it reads category names for each product.
plus i added the code for adwords conversion tracking because its in the same file success.tpl , so i thought there is no reason to make a separate vqmod script.
1) paste this after <?php } ?> in the script
in the scripts it is included a modified sample from google page.
change the nessesery values and you are done.
2) added this on success.php section of the script
3) added this on order.php section of the script
4) added this to where 'Products' was
i will start making an adwords remarketing code vqmod as well.
if i get permission from the original author of this script i will added it to extension repository.
please test if its working on your version of OC and report back
<< check file comment for some info >>
*thanks to all in all this pages that made me understand and modify the script.
use at will at your sites, but please respect the work made and do not sell this script.
this way we can continue to share our work with you all !
i made some modifications in the script for oc 1.5.1.3 so it reads category names for each product.
plus i added the code for adwords conversion tracking because its in the same file success.tpl , so i thought there is no reason to make a separate vqmod script.
1) paste this after <?php } ?> in the script
Code: Select all
<!-- Google Code for xxxxxxx Purchace Conversion Page -->
<script type="text/javascript">
var google_conversion_id = 1234567890;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "666666";
var google_conversion_label = "Purchase";
var google_conversion_value = <?php echo $orderDetails['total']; /* total */ ?>;
</script>
<script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/1234567890/?value=<?php echo $orderDetails['total']; /* total */ ?>&label=jh2jCIX01AQQq4LN2QM&guid=ON&script=0"/>
</div>
</noscript>
change the nessesery values and you are done.
2) added this on success.php section of the script
Code: Select all
$this->data['orderCategory'] = $this->model_checkout_order->getOrderCategory($this->session->data['order_id']);
Code: Select all
public function getOrderCategory($order_id)
{
$query = $this->db->query("SELECT " . DB_PREFIX . "category_description.name, " . DB_PREFIX . "order_product.product_id FROM " . DB_PREFIX . "category_description LEFT JOIN " . DB_PREFIX . "order_product ON " . DB_PREFIX . "order_product.order_id = '" . (int)$order_id . "' LEFT JOIN " . DB_PREFIX . "product_to_category ON " . DB_PREFIX . "product_to_category.category_id = " . DB_PREFIX . "category_description.category_id WHERE " . DB_PREFIX . "order_product.product_id = " . DB_PREFIX . "product_to_category.product_id AND " . DB_PREFIX . "category_description.language_id =1 GROUP BY product_id ORDER BY product_id ASC");
return $query->rows;
}
Code: Select all
$orderCategory[$i]['name']
if i get permission from the original author of this script i will added it to extension repository.
please test if its working on your version of OC and report back
<< check file comment for some info >>
*thanks to all in all this pages that made me understand and modify the script.
use at will at your sites, but please respect the work made and do not sell this script.
this way we can continue to share our work with you all !
Attachments
need changed for conversion , OC 1.5.1.3 tested. for 1.5.2.1 change create( to addOrder(
Thanks for your earlier ecommerce tracking VQMOD delivery. Come in handy!philbydevil wrote:Try this xml for 1.5.4.1:
How can I (instantly) check if it's delivering the needed variable to Google Analytics, by doing a dummy purchase?
Regards.
"Drop carts, not bombs"
i am planning to release this mod to the extensions repo as a free extension
can you please tell me , is it working for you ?
this is tested on a opencart 1.5.1.3
i am going to make it for last version too.
if you have had any problems at all , please report them so i can handle them and make a release for as many as possible versions .
thanks
can you please tell me , is it working for you ?
this is tested on a opencart 1.5.1.3
i am going to make it for last version too.
if you have had any problems at all , please report them so i can handle them and make a release for as many as possible versions .
thanks
im getting the following noitce in the error log. i've tried clearing the cache and still happens, everything seems to work, just a bit annoying .
"2013-04-27 14:51:14 - PHP Notice: Undefined variable: orderDetails in /home/www2/public_html/vqmod/vqcache/vq2-catalog_view_theme_gentle_template_common_success.tpl on line 63
2013-04-27 14:51:14 - PHP Notice: Undefined variable: orderDetails in /home/www2/public_html/vqmod/vqcache/vq2-catalog_view_theme_gentle_template_common_success.tpl on line 70"
any ideas?
"2013-04-27 14:51:14 - PHP Notice: Undefined variable: orderDetails in /home/www2/public_html/vqmod/vqcache/vq2-catalog_view_theme_gentle_template_common_success.tpl on line 63
2013-04-27 14:51:14 - PHP Notice: Undefined variable: orderDetails in /home/www2/public_html/vqmod/vqcache/vq2-catalog_view_theme_gentle_template_common_success.tpl on line 70"
any ideas?
I know the version i updated this for was working on 1.5.2.2 but have not tried any of the latter ones since.spaniakos wrote:i am planning to release this mod to the extensions repo as a free extension
can you please tell me , is it working for you ?
this is tested on a opencart 1.5.1.3
i am going to make it for last version too.
if you have had any problems at all , please report them so i can handle them and make a release for as many as possible versions .
thanks
I am getting this error... any idea how I can fix it?
OC 1.5.5.1
OC 1.5.5.1
Code: Select all
*******************************Fri.log********************************
---------- Date: 2013-05-24 08:07:49 ~ IP : 113.210.0.108 ----------
REQUEST URI : /index.php?route=checkout/confirm
MOD DETAILS:
modFile : /home/vcom/public_html/vqmod/xml/vqmod_catalog_google_analytics_e-commerce_adwords_conversion.xml
id : Google Analytics - E-Commerce
version : 1.0.0
vqmver : 1.0.8
author : added convertion tracking by darkraven-spaniakos
SEARCH NOT FOUND (ABORTING MOD): public function create($data) {
----------------------------------------------------------------------
probably hasnt been updated for 1.5.5.1. The script is failing because it cannot find this line in the "catalog/model/checkout/order.php" file:
Looks like that function has changed, so you'd have to look at your order.php and see what it says. maybe they just renamed the function in it. you should be able to review the changes on github
Code: Select all
public function create($data) {
Looks like that function has changed, so you'd have to look at your order.php and see what it says. maybe they just renamed the function in it. you should be able to review the changes on github
I guess my best bet is to manually add the tracking variables into the code.
Just out of curiosity, how do you guys actually keep an inventory on the inevitable manual code edits you've done to OpenCart and making sure that you don't overwrite them when you upgrade to the latest version of OpenCart?
Just out of curiosity, how do you guys actually keep an inventory on the inevitable manual code edits you've done to OpenCart and making sure that you don't overwrite them when you upgrade to the latest version of OpenCart?
Most of these are done vqmods so they dont overwrite the existing code. when you decide to upgrade (which there usually isn't a reason to do for every version) then you test and see which vqmods fail and fix them from there.
so your vqmod folder is more or less your inventory of what needs to be updated when a new release comes out.
Also, OC uses like an override process where it'll look at your custom file before the standard default. So if you need to edit a file directly, you'll want to add it into your theme folder (using same folder structure) and it'll pull from there first and if it doesn't exist it'll use the default one.
so your vqmod folder is more or less your inventory of what needs to be updated when a new release comes out.
Also, OC uses like an override process where it'll look at your custom file before the standard default. So if you need to edit a file directly, you'll want to add it into your theme folder (using same folder structure) and it'll pull from there first and if it doesn't exist it'll use the default one.
Who is online
Users browsing this forum: No registered users and 43 guests