Magento Google Analytics Content Experiments - magento

What is the simplest way to implement Google Analytics Content Experiment into Magento CE?
I want to test home page content.
Adding the Testing Code to CMS pages does not work. Testing Tag is after Analytics Tag.
Does Magento support adding the Testing Tag via admin Interface?
Or is there a simple way to add the tag via XML Layout Update?
Would it be possible to use Google Tag Manager to add the codes we need?

Tags could be installed after body like:
Add to local.xml in your layout folder following code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Last loaded layout file
-->
<layout>
<default>
<reference name="after_body_start">
<block type="cms/block" name="tags-first-in-body" before="-">
<action method="setBlockId"><block_id>tags-first-in-body</block_id></action>
</block>
</reference>
</default>
</layout>
and add a static block called tags-first-in-body.
Insert code to this block.

Related

How do I add a new block to my layout in magento 1.9?

I have a beginner question on layouts ...After reading a lot about layouts, i am more confused than where i started. I want to add a banner block that will be displayed on my home page and a few other pages. I decided that it cannot be a part of the header.
I want to add this right below the header. I am trying to create my layout via bootstrap. I see in some themes that this is done inside the cms.xml file and i am not sure why i need to edit that. Clearly, i am confused..
Any help would be appreciated.
Go to your theme
app/design/frontend/Your-Package/Your-Theme/layout/local.xml
add below code:
<?xml version="1.0"?>
<layout version="0.1.0">
<cms_index_index>
<reference name="content">
<block type="core/template" name="banner" before="-" template="banner/banner.phtml" />
</reference>
</cms_index_index>
</layout>
add banner.phtml file to
app/design/frontend/Your-Package/Your-Theme/template/banner/banner.phtml
add your banner in above file
To add a block to any other page replace <cms_index_index> with <routname_controllername_actionname> For example, <catalog_product_view>.

Magento design update to replace list.phtml on search results page only

How would I issue a design update to Magento to replace the list.phtml template only for the search results page? Is there more than one way to do it? It would be ideal if there was a way to do it through the admin panel like I can for individual categories, but if not then editing an xml file is okay too.
You should create the file: app/design/frontend/YOURPACKAGE/YOURTHEME/layout/local.xml having the content:
<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
<catalogsearch_result_index>
<reference name="search_result_list">
<action method="setTemplate"><template>custom/list.phtml</template></action>
</reference>
</catalogsearch_result_index>
</layout>
and to create your custom template like app/design/frontend/YOURPACKAGE/YOURTHEME/template/custom/list.phtml

How do I add a new page to the customer account dashboard?

I have edited the customer.xml file to add a new link to the dashboard page. I added the following line
<action method="addLink" translate="label" module="customer"><name>newpage</name><path>customer/newpage/</path><label>My New Page</label></action>
I've also added the following block to customer.xml
<customer_newpage_index translate="label">
<label>Customer My newpage</label>
<!-- Mage_Customer -->
<update handle="newpage"/>
<reference name="my.account.wrapper">
<block type="customer/newpage" name="newpage" before="-" template="customer/newpage.phtml"/>
</reference>
</customer_newpage_index>
And added a template file at template/customer/newpage.phtml
The link displays, but I get a 404 page when I view /customer/newpage/
What am I missing here?
Thanks
You need to add a controller called NewpageController.php and in it have an action called indexAction. It is probably not a good idea to add this controller inside of the Customer module, because that is in core, and we never touch core. Instead, what you probably want to do is create your own module and put the controller inside of that. It can still be added as one of the links to the sidebar like you have done, but from the outside so that when you upgrade Magento you won't lose your controller.

Is it possible to define Magento layout updates on a per-store basis

I have a single Magento install running two different websites. One sells ebooks and the other not and so the business team would like to see the "My Downloads" link removed from the customer navigation block in the My Account area of the application.
I can see the link defined in design/frontend/base/layout/downloadable.xml but cannot see any way defined that would let me disable the link on just one of the websites. Obviously, I could override this XML to turn off globally but I need the change to be limited in scope.
How do you define layout overrides on a single website or store in a multi site Magento installation?
Based on the responses below, I have done the following:
Created app/local/Mage/Customer/Block/Account/Navigation.php and added a method removeLink() which is not in the core code.
If I make the following change in local.xml, the download link is removed:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<remove name="catalog.compare.sidebar"/>
</default>
<customer_account>
<reference name="customer_account_navigation">
<action method="removeLink" translate="label" module="downloadable"> <name>downloadable_products</name></action>
</reference>
</customer_account>
</layout>
But, if try to target a specific store, it is not. E.g.
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<remove name="catalog.compare.sidebar"/>
</default>
<STORE_mm>
<customer_account>
<reference name="customer_account_navigation">
<action method="removeLink" translate="label" module="downloadable"> <name>downloadable_products</name></action>
</reference>
</customer_account>
</STORE_mm>
</layout>
As Anton suggested, set a new layout theme for your store. Another approach for anything site-wide + store-scoped would be to use the store layout handle - it's like a <default> handle which is applied each store. If your store code (under Manage Stores > Store View) is 'foo' the store layout handle would be <STORE_foo>.
Ref. Mage_Core_Controller_Varien_Action::addActionLayoutHandles()
Create different themes for this websites.
Create app/design/frontend/default/website1/layout/local.xml
and app/design/frontend/default/website2/layout/local.xml
Where you can make changes needed for downloadable layout.
This is described in magento feature.

ColorBox integration in Magento

I want to add ColorBox jQuery in my Magento website. Is there an specific method for this?
Or do I have to make the changes in .phtml files?
To add new javascript library on all your pages use layouts. Create new layout file yourmodule.xml and put there code
<default>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/colorbox.js</name><params/></action>
<action method="addItem"><type>skin_css</type><name>js/colorbox.css</name></action>
</reference>
</default>

Resources