Skip to content

Commit b35dbfe

Browse files
committed
Added google analytics
1 parent ed6b0f2 commit b35dbfe

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

index.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ <h3 id="addbutton">Add the button to your site</h3>
519519
<p>Copy and paste the HTML snippet you customized above, and you're ready to start selling!</p>
520520
</li>
521521
</ol>
522-
522+
523523
<h3>Environment</h3>
524524
<p>In order to test your implementation before going live you can use our sandbox environment. Please check the <a href="http://developer.paypal.com/">Developer Portal</a> for further information.</p>
525525

@@ -537,6 +537,17 @@ <h3>Find out more</h3>
537537

538538
<script src="js/jquery.min.js"></script>
539539
<script src="js/bootstrap.min.js"></script>
540+
<script type='text/javascript'>
541+
var _gaq = _gaq || [];
542+
_gaq.push(['_setAccount', 'UA-36123826-1']);
543+
_gaq.push(['_trackPageview']);
544+
545+
(function() {
546+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
547+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
548+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
549+
})();
550+
</script>
540551
<script src="js/app.js"></script>
541552
</body>
542553
</html>

js/app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
// Build a map out of the form data
4242
for (i = 0, len = inputs.length; i < len; i++) {
4343
input = $(inputs[i]);
44-
44+
4545
if(input.is(':checkbox')) {
4646
if(input.is(':checked')) {
4747
data[input.attr('name')] = {
@@ -87,6 +87,11 @@
8787

8888
// Close the modal
8989
modal.modal('hide');
90+
91+
// Track Events
92+
if (data.button) {
93+
_gaq.push(['_trackEvent', 'JavaScriptButtons', data.button.value]);
94+
}
9095
});
9196

9297
}());

0 commit comments

Comments
 (0)