Hi,
I was wondering if anybody here has started using the new Universal Analytics code from Google (uses analytics.js instead of ga.js). If so have you gotten to track ecommerce transactions and how did you set it up?
From what I've read about it, the ecom aspect is called as a plugin so it's not loaded on to every page, but only the conversion page (checkout.complete). It requires that you provide it with data like order id, transaction values, and product information, which isn't shown on the checkout.complete page in version 4.
My questions are
How would you get ecom aspect to show up in the header of just the checkout.complete page and not on every page like the current analytics code does?
How is the best way to get the data from the order to populate the tracking script?
Any help or insights here would be greatly appreciated.
Thanks,
Chris
Chris,
I was wondering the same thing. Has anyone heard of this? Does CS-Cart support the new code?
Thanks,
Adam
[quote]It requires that you provide it with data like order id, transaction values, and product information, which isn't shown on the checkout.complete page in version 4.[/quote]
By “isn't shown” you don't mean “isn't available”, correct? All order info is available via the {$order_info} variable. You can apply that data to your javascript code like:
{literal}
function () {
order_id={{/literal}$order_info.order_id};{literal}
}
{/literal}
[quote name='tbirnseth' timestamp='1385084257' post='172112']
By “isn't shown” you don't mean “isn't available”, correct? All order info is available via the {$order_info} variable. You can apply that data to your javascript code like:
{literal}
function () {
order_id={{/literal}$order_info.order_id};{literal}
}
{/literal}
[/quote]
Yeah I think that's what I mean:) Thank you, I will take with this and see if I can get it to work. If I do I will post back here.
Adam, I brought it up in help ticket and the CS Cart folks said they would pass it on to the engineers so I except at some point it will be included in the cart.
So I think I have it working for the most part now. Basically it was a 2 step process for me ( probably not the ideal or only way to go about it, but it works). This is for Version 4.0.3
- Add the order details to the checkout.complete.tpl. I basically cut and pasted the parts which show the order info from the order details page and deleted the print and repay order stuff. This is will have the order details show up on the order complete page.
- Add the tracking code. I put the code to call the e com plugin in the index.tpl with the rest of the analytics code and the actual e com tracking code at the top of the checkout.complete.tpl so it only shows up after an order has been placed. Here is the code I used
```php
```
I didn't use the literal tag and it seems to work. The only issue I still have is that it won't track the taxes. I'm completely open to suggestions for improvement or questions - Thanks, Chris
Nice work. So does the order info need to actually be shown on the page for Google Analytics to pick it up (#1)? I would think you could just insert the script and let it do its thing in the background. Or do you include it b/c the {$order_info} variables aren't available on [color=#282828][font=arial, verdana, tahoma, sans-serif]checkout.complete.tpl?[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]I'll give it a try with just the script and wait to see if GA picks it up…[/font][/color]
[quote name='trek7k' timestamp='1390957860' post='176235']
Nice work. So does the order info need to actually be shown on the page for Google Analytics to pick it up (#1)? I would think you could just insert the script and let it do its thing in the background. Or do you include it b/c the {$order_info} variables aren't available on [color=#282828][font=arial, verdana, tahoma, sans-serif]checkout.complete.tpl?[/font][/color]
[color=#282828][font=arial, verdana, tahoma, sans-serif]I'll give it a try with just the script and wait to see if GA picks it up…[/font][/color]
[/quote]
I couldn't get it to work without the order info actually on the page. It would track conversions but none of the other info. The analytics script won't pull the info automatically from the database. From what I read on the Google page you can write a PHP script to pass the info into the analytics code without it displaying on the page and you could certainly hide it on the front end via HTML/CSS. The analytics script needs the order info to be included in check.complete page somewhere or passed to it from the database. I choose to display it because as a personal preference I like for the customer to see order information after the order is complete. Hope that helps you a bit.
$order_info is passed to checkout.complete.
Hey, I have read this thread and still haven't a clue how to do this in 3.4xx … I have implemented the code above several times with no luck.I am 100% sure it is pilot error. If someone here would like to get me set up correctly I'd be glad to shoot you a few bucks via paypal …
[size=3][font=arial,helvetica,sans-serif]Thanks for the information! Unfortunately, this set-up did not work for me. [/font][/size][font=arial, helvetica, sans-serif][size=3]The CS Cart version I worked with was [/size][/font]2.1.4 PROFESSIONAL.
[size=3][font=arial,helvetica,sans-serif]First I created the following file: [/font][/size]
[color=#008000][size=3][font=arial,helvetica,sans-serif]\skins\SKIN-NAME\customer\addons\my_changes\hooks\checkout\order_confirmation.override.tpl[/font][/size][/color]
[size=3][font=arial,helvetica,sans-serif][color=#333333]Instructions via [/color]http://kb.cs-cart.co…g-code-addition[color=#333333] (version 2.1.x)[/color][/font][/size]
[size=3][font=arial,helvetica,sans-serif][color=#333333]This code worked perfectly for me:[/color][/font][/size]
```php
{literal}
{/literal}
```
[size=3][font=arial,helvetica,sans-serif]I did not have to add any order details to the Complete File.[/font][/size]
[size=3][font=arial,helvetica,sans-serif]Additionally, I do not see why you couldn't just add the above code to the following file: [/font][/size][size=3][font=arial,helvetica,sans-serif][color=#008000]\skins\SKIN-NAME\customer\views\checkout\complete.tpl[/color] without having to create [/font][/size][font=arial, helvetica, sans-serif][size=3][color=#008000]order_confirmation.override.tpl[/color] file.[/size][/font]