stfalcon-studio / ab-test-bundle
Symfony AtfalconAbTestBundle
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 14
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- sonata-project/admin-bundle: ~2.1
- sonata-project/doctrine-orm-admin-bundle: ~2.2
- symfony/symfony: >=2.1
This package is not auto-updated.
Last update: 2024-10-30 07:28:23 UTC
README
Simple small bundle for add Google analytics A/B test code on site pages
Prerequisites
This version of the bundle requires:
- PHP >= 5.3.2
- Symfony >= 2.1
- SonataAdminBundle >=2.1
Installation
Installation is a quick 4 step process:
- Add StfalconAbTestBundle in your composer.json
- Enable the StfalconAbTestBundle
- Import StfalconAbTestBundle routing and update your config file
- Update your database schema
Step 1: Add StfalconAbTestBundle in your composer.json
{ "require": { "stfalcon-studio/ab-test-bundle": "*" } }
Now tell composer to download the bundle by running the command:
$ php composer.phar update stfalcon-studio/ab-test-bundle
Composer will install the bundle to your project's vendor/stfalcon
directory.
Step 2: Enable the StfalconAbTestBundle and requiremented bundles
Finally, enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... // For SonataAdminBundle new Sonata\CoreBundle\SonataCoreBundle(), new Sonata\BlockBundle\SonataBlockBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), new Sonata\AdminBundle\SonataAdminBundle(), new Stfalcon\AbTestBundle\StfalconAbTestBundle(), // ... ); }
Step 3: Update your database schema
Now that the bundle is configured, the last thing you need to do is update your
database schema because you have added a new entity the AbTest
.
Run the following command.
$ php app/console doctrine:schema:update --force
At this point you can already access the admin dashboard by visiting the url: http://yoursite.local/admin/dashboard. Getting started with SonataAdminBundle
Step 4: Add code in template
For add Google Analytics A/B test code in your pages you must add following code after <head>
tag in your main template.
{{ init_ab_test() }}
For add AbTest fill the form in admin part of site with:
Page Url - url of page where you want add A/B test code in header. Example: /page/some-page-slug
Code - Code of Google analytics A/B test. Example: 12345-6
And now if you'll open http://your-project/page/some-page-slug in HTML code of page will be added code for Google analytics A/B test
That's all!
Now that you have completed the installation and configuration of the StfalconAbTestBundle!