Download the PHP package heyday/silverstripe-googlecontentexperiments without Composer
On this page you can find all versions of the php package heyday/silverstripe-googlecontentexperiments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package silverstripe-googlecontentexperiments
SilverStripe Google Content Experiments
Integration with Google Content Experiments for SilverStripe. Allows for Experiment Data to be integrated with your application so that experiments can be served without the usage of the GCE javascript implementation. For more information please see running a server-side experiment.
License
SilverStripe Google Content Experiments is released under the MIT license
Installation
If using SilverStripe version 2.4, please use the 1.0.0 tag
$ composer require silverstripe-googlecontentexperiments
How to use
Setup
First you must set up the correct authentication details so that Google Content Experiments can retrieve data from your Google Analytics account.
To do this:
- Visit http://code.google.com/apis/console
- Sign in with the account you use to manage your analytics
- Create a new project for the website you wish to target
- Browse to 'Services' and enable the Analytics API
- Browse to 'API access' and click 'Create another client ID'
- Choose 'Service account'
- Download the private key and store it somewhere securely within your application directory
Once this is done, you will see the details for the service account. From here, you will need to copy the email address which was generated and add it to the analytics account you are targeting with 'Read & Analyze' access only. This will allow the server connection to read your experiment data.
Configuration
Once you have set up the account and downloaded the private key for your application we have to configure the service.
This can be completed in your _config.php
with the following. This code sets up the dependancy injection container
which is used.
Generally the following applies:
You also need to include the GoogleContentExperimentScripts somewhere on the page(s) you want to test.
Its also a wise move to set up a cron job which will run the processor periodically for you and pick up the new experiments so that you can then run them. This also will update variations status as the experiments progress.
Usage in templates
Templates are set up so that you can push the code without having to worry about the experiment being set up or running.
This means that there is a necessary <% else %>
to make sure that when experiments finish the page goes back to
'normal' until it can be updated to the winning solution.
GoogleContentExperimentVariation()
takes two parameters, which are separated by an underscore. The first is the
VariationID we are checking for, the second is the ExperimentID (internal ID). The above example shows three variation
possibilities for ExperimentID 1.
If you are only running one experiment per page, the ExperimentID is not needed, e.g. <% if GoogleContentExperimentVariation(0) %>
Contributing
Unit Testing
$ composer install --prefer-dist --dev
$ phpunit
Code guidelines
This project follows the standards defined in:
All versions of silverstripe-googlecontentexperiments with dependencies
composer/installers Version ~1.0
nyholm/google-api-php-client Version ~0.1
pimple/pimple Version ~1.0