Code: Select all
if (!empty($this->request->get['route'])) {
$data['route'] = $this->request->get['route'];
} else {
$data['route'] = '';
}
Code: Select all
<?php if (!empty($route) && $route == 'checkout/success') { ?>
// Your JS code here
<?php } ?>
Code: Select all
<?php if (!empty($route) && $route == 'common/success') { ?>
// Your JS code here
<?php } ?>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
The error message disappeared but the conversion code does not appear in the code of the checkout/success page, unfortunately.
I was looking around the internet about this issue but no luck. I found instructions for implementing the old Google Conversion Pixel code into the Analytics Extension module but they seem to have changed the code, it looks in a different way and the instructions does not apply. I didn't expect this to be that hard considering that almost every online store advertise in Google Adwords and the Conversion Pixel is a must...
According to my instructions above, there are two possible instructions provided for the routes. Based on your analysis, only one route has been tried.The error message disappeared but the conversion code does not appear in the code of the checkout/success page, unfortunately.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
<script>
gtag('event', 'conversion', {
'send_to': 'AW-8348324734/UI4H53GB4Y54YV4UO',
'transaction_id': ''
});
</script>
Then, it is contradictory compared to the top replies. You were looking to add this code within the success page but in reality you are looking to add this code at the final checkout page which would make more sense. I would suggest the load of a JS file from PHP in your order total: Total module within the confirm method of the catalog/model/extension/total/total.php file. This will load the JS file in-between the <head></head> of your header.tpl file automatically and only upon successful checkout transactions. Although, still take note that this successful order at this step may not necessarily mean that it may remain a successful order since an order can still be reverted as cancelled from the order statuses unless the order being completed from the admin orders or from an automated API already granting the order as being completed (more expensive package from providers).dol4er wrote: ↑Fri Feb 23, 2018 4:05 pmThe code is standard Google Adwords Conversion Tracking Pixel. It has to be placed only on the final checkout page so that it can count the number of successful orders.
<script>
gtag('event', 'conversion', {
'send_to': 'AW-8348324734/UI4H53GB4Y54YV4UO',
'transaction_id': ''
});
</script>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Unfortunately, it seems to me that you are more interested in making unsuccessful tries to find errors/contradictions/missing information in my posts than trying to help solving the problem. In total, 4 out of 7 posts you are criticizing my posts which is not very helpful and polite of you. None of your critics is justified, to my opinion.
I really hope there is someone in this forum who is really willing to help with this thing but it doesn't seem like there is for now.
This is Google Adwords Conversion Tracking Pixel, for God's sake... how can this be so hard to do and nobody can help me? Every online store should try to advertise in Adwords and use a Google Tracking Pixel... unbelievable...
I see. On your URL bar in your browser, manually try to add the checkout/success route or the common/success route. Users who types the route manually can still see the success page which means, according to your theory above, the success is the final page for successful order. If so, how can a successful order be described in this case if there are no order IDs related to their transaction from the browser when the query is manually typed? In addition, why would we need to have the confirm() method from the order totals if the success page can already handle it?What's more final than that?
Those are the questions you should rather ask yourself before posting since Opencart already provides the success page publicly on the browser without the need to rely on a specific order ID which means your Google code will have no purpose on this particular page other than if an order ID is implied. While having an order ID implicated with an order, logically speaking, the best location would be in the order totals confirm() method. In other words, it is still contradictory facts since you did say:
On more recent version, this is why this contradictory route has been moved to the common folder so to avoid further confusions by users since the final checkout step is the position from the flow where customers hits the: confirm button before being redirected to the common/success page upon successful orders.the final checkout page
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
While supporters may want to provide assistance, an OP must also be able to provide as much information in order to clarify the features he's using in the platform, and that by first reading the most recent forum rules that is already provided. Due to the countless possibilities of extensions that can be installed, one-to-many-to-unlimited people needs to understand the sizeless factors that users have been reporting over the years on the forum and on Github Opencart.
Using Opencart does not require technical skills but rather the proper understanding based on the marketing relations, since Opencart is mainly about selling products and services to customers with the most possible ways to complete the sales and the most fundamental and conceptual ways that supporters are hoping; not to see a topic about a reversed order status ID that wasn't necessarily reversed by Opencart itself.
This topic, in addition, is no exception. You are requiring assistance on using Google codes which is excluded from the Opencart core and needs to be added to the final checkout page. As explained on my previous reply, the confirm() method in your installed order status is where the code would be more relevant. However, if you are looking to add your JS code in your success page, you can always look for an extension on the marketplace.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I put the first code in the catalog/controller/common/header.php file, at the very beginning of the index() method
I then put the code in the catalog/view/theme/journal2/template/common/header.tpl file and used the second code since the success file being called in 2.3.0.2 is in common/success not in checkout/success.
However, it doesn't seem to have worked and doesn't show the google code after a successful checkout.
Any other ideas on how to make this work? I think your code is good, but just not working for some reason. I don't get any errors thrown, so that's good. Any help would be appreciated!
I see also the confirm() method as a place to try but when I open catalog/module/extension/total/total.php there isn't a confirm() method listed. Any idea where this might have moved to in 2.3.0.2?
Code: Select all
<?php
class ModelExtensionTotalTotal extends Model {
public function getTotal($total) {
$this->load->language('extension/total/total');
$total['totals'][] = array(
'code' => 'total',
'title' => $this->language->get('text_total'),
'value' => max(0, $total['total']),
'sort_order' => $this->config->get('total_sort_order')
);
}
}
Users browsing this forum: No registered users and 30 guests