javascript - Google Analytics for File Downloads not firing, placement issues? -


I'm not sure whether the placement is right or not ... and this should help me for this part ..

I have a web application that will create a list of dynamically available resources, and the resolution of the file information variable works perfectly ... I am getting the anchor tag such as code It's fit with:

    

... Google Analytics has been followed with my standard code which is:

  & lt; Script & gt; Var _gaq = _gaq || []; _gaq.push (['_ setAccount', 'UA-12345678-1']); _gaq.push (['_ trackPageview']); (Function () {var ga = document.createElement ('script'); ga.type = 'text / javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol? 'Http: //ssl': 'http: // www') + '.google-analytics.com / ga.js'; var s = document.getElementsByTagName ('script') [0]; s.parentNode.insertBefore (GA, S);}) (); & Lt; / Script & gt;   

Unfortunately, regardless of the number of clicks used on these links, triggers do not start recording in Google Analytics ... even after 24 hours - around four On or more ... I am using the wrong approach to popularize the triggers on my link or am using the wrong code to reference the trigger? Should I have the initial Google Analytics Marine Code at the top of my page?

I know that standard GA code works because I am seeing activity for various other pages ... but there is a problem to download files available from these links with respect ... when If it comes to GA then I am quite n00b, so I am open to any advice here ... what am I missing?

The problem is that onclick

/ Code> attribute no page has already been converted to the resource; setTimeout can be executed before the GA request You will see it by looking at the Networks tab in your Developer Console; The user has been sent for processing before onclick execute, as the GA request can never be completed.

You also seem to be using _gaq in the old version of Analytics, in place of ga ).

The correct way to do this is summarized on Google's summaries here. It's optimized for you:

  & lt; Script & gt; Var trackFileDownload = function (url, page, description) {ga ('send', 'event', 'file download', url, page + "+ description, {hitcallback}: function () {document.location = url; }};} & Lt; / script> & lt; an onclick = "trackFileDownload (this.href, 'resource: device', 'policy template: access to confidential information'); Returning; "Href =" / file.cfm? F = 402 and type = resource "& gt; policy template: access to confidential information & lt; / a & gt;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -