Comments (1)
Yes, definitely. But you have to host this project by yourself since I'll not implement it as an option.
Following is how you can integrate with Google Analytics. Don't forget running cake build:coffee
to rebuild all the javascript files.
diff --git a/buttons.html b/buttons.html
index 3b3b940..706c2e3 100644
--- a/buttons.html
+++ b/buttons.html
@@ -16,5 +16,14 @@
</head>
<body>
<script src="buttons.js"></script>
+ <script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', 'UA-XXXX-Y', 'auto');
+
+ </script>
</body>
</html>
diff --git a/src/elements.coffee b/src/elements.coffee
index d0ed96e..98f4639 100644
--- a/src/elements.coffee
+++ b/src/elements.coffee
@@ -196,6 +196,9 @@ class ButtonFrameContent
super "a", (a) ->
a.className = "button"
a.href = options.href if options.href
+ @on "click", ->
+ ga 'send', 'social', 'github', options.text, options.href
+ return
new Element "i", (icon) ->
icon = document.createElement "i"
icon.className = do ->
@@ -221,6 +224,9 @@ class ButtonFrameContent
super "a", (a) ->
a.className = "count"
a.href = options.data.count.href if options.data.count.href
+ @on "click", ->
+ ga 'send', 'social', 'github', options.text, options.href
+ return
new Element "b", (b) ->
a.appendChild b
return
from github-buttons.
Related Issues (20)
- asynchonous button load HOT 1
- Accessibility: Keyboard focus styling isn't very visible HOT 1
- tried to use in a chome extension but didnt work due to following error HOT 2
- IE 9 10 11 Edge caching issue HOT 3
- Subresource integrity HOT 2
- Add HTML only implementation for buttons without counting HOT 2
- Styling HOT 2
- AdblockPlus is blocking the star button HOT 1
- Up to date | Free CDN
- Show count doesn't work HOT 2
- font size HOT 1
- add option to hide text while loading HOT 2
- add title attribute to link HOT 3
- Buttons are not styled when page loads HOT 5
- Suggestion: support multi-user sponsors HOT 5
- Clicking on the follower count results in 404
- Why is shadow DOM closed? HOT 2
- Custom URL for the Sponsor button HOT 2
- Unnecessary request for unexpected properties HOT 4
- Buttons get temporarily styled on SvelteKit before going back to unstyled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github-buttons.