Last active
September 21, 2016 22:48
-
-
Save strategyst/0407209b0d893f212fb1c5bc375e01c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 GA Content Experiments Scripts Here | |
*/ | |
function content_experiments_head_script() { | |
// Replace '2' with the post/page ID of the original version of the page you are testing | |
if(is_page(2)) { ?> | |
<!-- Load the Content Experiment JavaScript API client for the experiment --> | |
<script src="//www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID"></script> | |
<script> | |
// Ask Google Analytics which variation to show the user. | |
var chosenVariation = cxApi.chooseVariation(); | |
</script> | |
<?php } | |
} | |
add_action( 'wp_head', 'content_experiments_head_script' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment