Google Analytics & Adwords delayed javascript link to App Store ignored? -


i'm trying measure conversion both google adwords campaign , normal traffic going app store. had link "/app_store/" on page load, wait 1 second , continue app store.

i found more elegant solution somewhere using javascript. adwords loads pixel image , analytics calls google javascript function, pauses fraction of second , follows link.

unfortunately it's not working me. google analytics , google adsense don't see going app store (not myself).

<script type="text/javascript">   var _gaq = _gaq || [];   _gaq.push(['_setaccount', 'ua-18180332-1']);   _gaq.push(['_trackpageview']);  (function() {     var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true;     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';     var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })();  function recordoutboundlink(link, category, action) {     try{         // google analytics         var pagetracker = _gat._gettracker("ua-18180332-1");         pagetracker._trackevent(category, action);          // google adwords         var image = new image(1, 1);         image.src = "http://www.googleadservices.com/pagead/conversion/1046551421/?value=$8&amp;label=zqrfcmwh0qeq_bae8wm&amp;guid=on&amp;script=0"         settimeout('document.location = "' + link.href + '"', 100)      } catch(err) {} } </script> 

and link:

<a href="http://itunes.apple.com/ae/app/isimplifiedchinese/id377690407?mt=8" onclick="recordoutboundlink(this, 'outbound links', 'http://itunes.apple.com/ae/app/isimplifiedchinese/id377690407?mt=8');return false;"> <img alt="appstore" src="images/appstore.png"></a> 

what doing wrong here?

update 23:13 noticed if delay 100ms, following error flashes (it took me while time screenshot).

failed load resource

i tested erwan's suggestion; not sure if happened in old version. error seems go away longer delays; set 300ms on safe side.

you should prevent click action (browse link) beeing executed until record it. on onclick attribute add "return false":

onclick="recordoutboundlink(params);return false;" 

hope helps


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -