No google ecommerce data is showing up in analytics.
I have have the docs, used the ga_debug.js plugin for Chrome, no errors are thrown. Poured over my code to find an error, but don't see any. Anyone see any errors in my snippet here?
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
513,
Storename,
99.95,
0,
3.95,
Matthews,
NC,
US
]);
_gaq.push(['_addItem',
513,
6,
The Driver's License Pet Tag,
none,
19.99,
1
]);
_gaq.push(['_addItem',
513,
7,
Pet Driver's License Bag Tag,
none,
19.99,
2
]);
_gaq.push(['_addItem',
513,
5,
Pet Driver's License Key Chain,
none,
19.99,
2
]);
_gaq.push(['_trackTrans']);
// load Analytics
(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);
})();
</script>
If anyone has any insights into this, please help. I don't see any reason why this should be happening.
Did you look at the documentation for e-commerce tracking?
You need to surround your values in quotes. This is actually basic javascript syntax, not GA specific syntax.
Example (you need to do it for all of your values in all of your .push() calls):
_gaq.push(['_addTrans',
"513",
"Storename",
"99.95",
"0",
"3.95",
"Matthews",
"NC",
"US"
]);
Related
I want to use Piwik to trace which user stays on which page in my rails app but I cannot figure out how to trace it. I added a custom variable (page scope) but in Piwik I only see the user_id and its count of visits but not which pages. Also, I got url based view but not for which user. Anybody knows how to deal with this? Also I can not use custom Dimension because my Piwik version is older and I can not upgrade it now. I tried setUserId option as well but no luck.
My code :
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['setCustomVariable', 1, "user_id", "<%= current_user.id %>", "page" ]);
_paq.push(['setUserId', '<%= current_user.id %>']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(['enableHeartBeatTimer']);
(function() {
var u="//myserver/piwik/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//myserver/piwik/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
I am trying to fix all the validation errors in my site. I have the majority of them however when I add in my Facebook remarketing code
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
_fbq.push(['addPixelId', "1234567890"]);
})();
window._fbq = window._fbq || [];
window._fbq.push(["track", "PixelInitialized", {}]);
</script>
<noscript><img height="1" width="1" border="0" alt="" style="display:none" src="https://www.facebook.com/tr?id=1234567890&ev=NoScript" /></noscript>
(sample code from https://developers.facebook.com/docs/ads-for-websites/website-custom-audiences/getting-started)
I get 3 errors, Stray end tag head, Start tag body seen but an element of the same type was already open and Cannot recover after last error. Any further errors will be ignored.
If I take the tag out I get the rest of the errors from the page but the link above says not to change anything from the code except the pixelId.
I was wondering if anyone had a similar issue and new how to fix it?
I want custom tracking in analytics. I have a custom JavaScript site.
When you click on the button I fire this code:
_gaq.push(['_trackEvent',1, 'Stappen', 'Eerste stap - Type woning']);
But when I go to analytics, by the events, it's not showing. It's not showing in analytics. What have I done wrong, am I missing something?
The code in the header:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34399608-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Are you using ga.js version on the analytics script? This is a requirement to use event tracking.
I would also look at the even tracking code, the 1 would need to be '1', and look like the code below on your html button:
<button type="button" onClick="_gaq.push(['_trackEvent', '1', 'Stappen', 'Eerste stap - Type woning']);">Button</button>
Google event tracking help section is here: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
Since i'm using Google CSE, the main idea is to show the "Top Search Terms" under the CSE Search box. But in the CSE panel, Google is saying:
No queries were sufficiently popular to be listed
So anyway (i don't want to wait it to be sufficient enough and) .. i want to implement it on my own.
What is the best way to capture the submit of the search string (to Google) ?
Or
What is the best way to capture the returning results (back from Google) so i can assume the Search Term has been used. So i can mark/save the current search term.
.
As a reference, this is all i've done so far:
<!-- Goolge CSE -->
<script language="JavaScript">
(function() {
var cx = 'xxxx3941849086xxxxx:xxxxmtk5xxxxxx';
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
</script>
<body>
<!-- GCSE Search Box -->
<div class="global-search">
<gcse:searchbox-only linktarget="http://www.example.com/search" queryParameterName="query"></gcse:searchbox-only>
</div>
<!-- GCSE Result Div -->
<div id="googlecse-result">
<gcse:search linktarget="_parent" queryParameterName="query"></gcse:search>
</div>
</body>
I find the value of the search term here and save in my own db:
google.search.cse.element.getElement('standard0').getInputQuery()
I wouldn't advise you hardcoding 'standard0'.
If you give your gcse elements a name using gname="SomeName" then you can use this as a reference.
google.search.cse.element.getElement('SomeName').getInputQuery()
I have 3 google +1 buttons in the same wordpress page. But one of them fails when is clicked (in then float lateral widget) showing an exclamation mark.
When click again the following page is opened:
+1 button is unavailable or has stopped working. I am pretty sure that none of the described possible reasons occur.
The code for both is practically the same:
// float code (malfunction)
<div id="float_plusone">
<g:plusone size="tall" href="<?php echo urlencode(get_permalink()); ?>" count="true"></g:plusone>
</div>
<script type="text/javascript">
(function() {
var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
})();
</script>
// above/below posts code (works)
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<g:plusone size="medium" callback="googleplus_click"></g:plusone>
Any suggestion about is very welcome.
This is the URL the button is sending to the server to +1.
"id":"http://bestpushchairs.net/qc21/disclosure-policy/http%3A%2F%2Fbestpushchairs.net%2Fqc21%2Fdisclosure-policy%2F"
It looks like the button is taking the href value and assuming it is relative to the current path. Try not using urlencode.