This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function theme_set_post_views($id) { | |
$count_key = 'theme_post_views_count'; | |
$count = get_post_meta($id, $count_key, true); | |
if ($count == '') { | |
$count = 0; | |
delete_post_meta($id, $count_key); | |
add_post_meta($id, $count_key, '0'); | |
} else { | |
$count++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class Analytics | |
* @author Joshua Russell <josh.russell@holler.com.au> | |
* | |
* A wrapper class for sending Google Analytics events | |
* https://developers.google.com/analytics/devguides/collection/analyticsjs/events | |
* ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue]); | |
* | |
* Usage: | |
* Add a data-ga to html elements to track `click` events |