Hi,
Trying to track the clicks on the link by pasting the code below to the product detailed description area and it does’t track anything:
Download Now
There is no tracking info for this link in the Google analytics accout, although there are many clicks to this link per day.
It was tested on cs-cart 1.3.5 and all worked fine. Please, help. Thanks.
the same. may be somebody knows the reason?
When you do a “view source” when on a product detail page, do you see your script code? Does it look correct? Is any of it visible in your product descriptions?
A link to one of your product detail pages would be helpful.
Normally these are not put in the description, but rather in the footer after all the rest of the page is rendered.
[quote name=‘tbirnseth’]When you do a “view source” when on a product detail page, do you see your script code? Does it look correct? Is any of it visible in your product descriptions?
A link to one of your product detail pages would be helpful.
Normally these are not put in the description, but rather in the footer after all the rest of the page is rendered.[/quote]
Yes, everything looks normal. I try to track attachments downloads and have added in the details_page.tpl where attachments are defined the following:
Therefore every attachment has their unique path, but google analytics doesn’t track it
but_onclick="javascript: pageTracker._trackPageview('/attachments/a`$attach.attachment_id`');"
Here is the page of the product [URL]http://www.modelplusmodel.com/accessories/f04-green-apples-3dmodel.html[/URL]
Also when downloading an attachment appear the text at the top of the page “Loading… Your request is being processed, please wait.” It doesn’t leave the page until refresh it. May be it’s some bug because I notice this on many cs-cart shops.
I think your syntax is incorrect. Try:
but_onclick="javascript: pageTracker._trackPageview('/attachments/a{$attach.attachment_id}');"
Unless of course this segment is already within a set of {}'s.
[quote name=‘tbirnseth’]
Unless of course this segment is already within a set of {}'s.[/quote]
Yep, it’s inside {include} tag therefore I use `` instead of {}. The code displays normal in HTML
May be there is another way to track downloads, or may be ez-ms.com give us a new addon
[QUOTE]Important: if your pages include a call to _trackPageview, _setAllowLinker _trackTrans(), your Analytics tracking code must be placed in your HTML code above any of these calls. In these cases the tracking code can be placed anywhere between the opening tag and the JavaScript call.[/QUOTE]
You have your tracking code at the bottom of the page. Move it above these calls should fix the problem.
Not sure it matters “where” in the code since the data is already resolved.
All appears correct. I would think next step would be to have Google turn on debugging for your account and to track what’s coming in.
Think the ball moves to their court.
Thank you much nmband tbirnseth. I have placed the tracking code in the beggining of the page inside body tag and installed [COLOR=#000000]Google Analytics Tracking Code Debugger into Chrome browser. Cs-cart seems to use a new async code of google analytics, therefore I found that it’s needed to use [/COLOR]_gaq.push
but_onclick="_gaq.push(['_trackPageview', '/attachments/a`$attach.attachment_id`']);"
Details of this I found here (See Virtual pageviews)[URL=“http://code.google.com/intl/en/apis/analytics/docs/tracking/asyncMigrationExamples.html#VirtualPageviews”] http://code.google.com/intl/en/apis/analytics/docs/tracking/asyncMigrationExamples.html#VirtualPageviews[/URL]
Also it’s better to track downloads with the trackEvent, because trackPageview will add to the total pageview count.
I’ll post with the results soon.
Great info…
Looking forward to you results.
If you posted the code from Google into your page then cs-cart is NOT using anything different. If you’re talking about their analytics interface in general then they use the __utm.gif method and use a GET request consisting of order information in one request and then a request for each product in the order with product details. So an order with 10 items gets 11 requests. See the function fn_google_analytics_send() in addos/google_analytics/func.php.
Please post all the Google code that you end up using if you would please.
[quote name=‘tbirnseth’]
Please post all the Google code that you end up using if you would please.[/QUOTE]
Finally everything works fine. Try to explain.
To track how much users download certain attachment you can setup events or virtual pageviews. When it’s an event it shows in the Events page of GA, it’s more handy because it doesn’t mixed with other pages. But when it is a pageview you can setup goals with them (though 20 goals is a limit). Therefore I chose events.
- Find the file where your attachments are defined. Suppose it is yourskin\customer\addons\attachments\blocks\product_tabs\attachments.tpl
- Add to the tag the onclick function onclick=“_gaq.push([‘_trackEvent’, ‘Category’, ‘Action’, ‘Label’]);”. That is
Replace:
Where Category and Action are just words(categories in GA) that you can replace with your own, and {$file.description} is the name of your attachment, that will appear in your GA report as a label. The Category and Action are required parameters, but you can use for example {$file.description} instead of Action, if you needn’t so much categories.
3. May be you will also need to place tracking code of GA in the beginning of the page.
That’s all, after 24 hours you will be able to see results of event tracking. Detail description of events may find here [URL=“http://code.google.com/intl/en/apis/analytics/docs/tracking/eventTrackerGuide.html”]http://code.google.com/intl/en/apis/analytics/docs/tracking/eventTrackerGuide.html[/URL]
If you still have problems use tool for Chrome browser [URL=“Google Analytics Debugger - Chrome Web Store”]https://chrome.google.com/extensions/detail/jnkmfdileelhofjcijamephohjechhna[/URL]
if you need to setup virtual pageview just write onclick=“_gaq.push([‘_trackPageview’, ‘/attachments/{$file.description}’]);”
Thank you for the clean and concise description…