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
<?php | |
/** | |
* Author: Alin Marcu | |
* Copyright 2018 Alin Marcu | |
* Author URI: https://deconf.com | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
$curl = curl_init(); |
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
/* Analytics Code */ | |
function gadwp_addcode( $gadwp ) { | |
$commands = $gadwp->get(); // Get commands array | |
$fields = array(); | |
$fields['option'] = 'userId'; | |
$fields['value'] = get_current_user_id(); | |
if ( $fields['value'] ){ | |
$command = array( $gadwp->prepare( 'set', $fields ) ); | |
array_splice( $commands, -1, 0, $command ); //insert the command before send | |
} |
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
<?php | |
/* Analytics Code */ | |
function gadwp_addcode( $gadwp ) { | |
$commands = $gadwp->get(); // Get commands array | |
array_pop( $commands ); // Pop the last element | |
$fields = array(); | |
$fields['hitType'] = 'pageview'; | |
$commands[] = $gadwp->prepare( 'send', $fields ); // Add a new line to the commands array |
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
add_filter( 'gadwp_backenditem_uri', 'gadwp_uri_correction', 10, 2 ); | |
function gadwp_uri_correction( $uri, $filter_id ){ | |
$newuri = str_replace( '/test', '', $uri ); //it could be anything, we are removing /test as an example | |
return $newuri; | |
} |
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
<?php | |
function gadwp_bouncerate_adjustment() { | |
?> | |
<script type="text/javascript"> | |
setTimeout( "ga('send','event','Read Engagement','time on page more than 10 seconds')", 10000 ); | |
</script> | |
<?php | |
} | |
add_action( 'wp_footer', 'gadwp_bouncerate_adjustment', 100 ); | |
?> |