I am trying too Enable Demographics and Interests reports in Universal Analytics in my Magento site.
I have read through the already existing question on this and it does not answer my problem: Enable Demographics and Interests reports in Universal Analytics
I already have Universal Analytics set for my Magento site, which was done by simply entering my Google Analytics Account Number in the Magento Backend. It has been working fine for the last few months but I now want to Enable Demographics and Interests reports.
Google Analytics tells me "Your Demographics and Interest Reports have been enabled, but your Analytics tracking code does not include the necessary support to show them", and directs me to the following information page: https://support.google.com/analytics/answer/2444872?hl=en&utm_id=ad
It tells me to simply add the following code into the existing tracking code:
ga('require', 'displayfeatures');
I found out that this code should be located at:
app/design/frontend/default/YOURTHEME/template/page/html/head.phtml
However when I open this file, the only code in it is as follows:
<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle() ?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<?php if(Mage::getStoreConfig('milanoconfig/generaloptions/responsive') == 1): ?>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<?php endif; ?>
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
<?php echo $this->getIncludes() ?>
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->
From what I have read, this file should also include the following Google Analytics code, but it doesn't:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX-XX', 'example.com');
ga('send', 'pageview');
</script>
Does anyone know why this code isn't currently in this file even though my Google Analytics appears to be working fine, after simply adding the Google Analytics Account Number in the Magento Backend?
Does anyone also know what I should now do to Enable the Demographics and Interests reports. Should I simply add this code manually, or is there a reason why this code isn't already in place, maybe Magento is set up differently these days? I use Magento version 1.7.0.2.
Thanks
Related
I've an e-commerce site in Magento 1.9 with two version: English and French. I've to change some words in both English version and in the French. For example, in the English version, I've to change word "BAG" in the homepage menu.
I've to replace "BAG" with "SHOPPING BAG" but, inserting string "BAG", "SHOPPING BAG" (or "bag","shopping bag", or "Bag", "Shopping bag") into translate.csv of the theme (in the English folder) any change is shown in the frontend. Activating path hints for the English version I notice that the phtml file that builds the block that contains this menu is the following:
<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle()?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
if (preg_match('/^https/', $currentUrl)) {
$currentUrl = str_replace('https://', 'http://', $currentUrl);
}
$exclusions = array(
'checkout/',
'customer/account/'
);
$regexUrl = '/^' . str_replace(array('/', '.'), array('\\/', '\\.'), Mage::getBaseUrl() . '(?:(?:' . implode(')|(?:', $exclusions) . '))') . '/';
if (!preg_match($regexUrl, $currentUrl)) {
echo '<link rel="canonical" href="' . $currentUrl . '" />';
}
?>
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>
<?php echo $this->getIncludes() ?>
I think that there are some function (may be getHtmlChild()) that overwrites my translation because other words are translated adding new strings into traslate.csv.
Which file or function I've to change to see "shopping bag" in the frontend of my site? Why some words are changed with translate.csv and others not? Can you help me, please? Thank you very much!
First, all strings in the translation files are casesensitive.
When I look for a word to translate for example "add to my cart" then I usually do like this:
Open a terminal and go to the root of your magento shop and run:
cd app
git grep "add to my cart" | grep csv
This gets all the hits from all your translation files in your entire project.
My result looks like this:
design/frontend/fortis/eke/locale/sv_SE/translate.csv:1:"Add to Cart","add to my cart"
locale/sv_SE/Mage_Catalog.csv:33:"Add to Cart","add to my cart"
In the result, first you se the path to the file and then the translation.
In my example the string was already translated. But now you know exactly what the base string is. Use this in you own translation file.
If you don´t get a hit in the translation files then the word or sentence might come from a cms-block or cms-page. To search for it there you have to connect to your SQL server and run some querys like this (one at the time):
select * from cms_block where content like '%add to my cart%';
select * from cms_page where content like '%add to my cart%';
From the result you can see what the block or page with the string is named. Go the backend and edit it.
Why the header and footer comes after body when rendered? (Planets Tutorial). The planets who are using the planet.php template are children of a page Planets which is based on basic-page.php template. The About page children pages works fine though.
site/templates/planet.php
<html>
<head>
<title><?php echo $page->title; ?></title>
</head>
<body>
<h1><?php echo $page->title; ?></h1>
<h2>
Type: <?php echo $page->planet_type; ?>,
Age: <?php echo $page->planet_age; ?> years
</h2>
<p><?php echo $page->planet_summary; ?></p>
</body>
</html>
Doing a manual intermediate install solved it.
Iam using CI version 2.1.2
iam following course by tutplus training
this problem is a when i call the javascript file that's not working properly
iam very counfused day to day iam thingking how make it solved, buat iam cannot
here the script of my page_head file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $meta_title; ?></title>
<!-- Bootstrap -->
<link href="<?php echo site_url('css/bootstrap.min.css'); ?>" rel="stylesheet">
<link href="<?php echo site_url('css/admin.css'); ?>" rel="stylesheet">
<link href="<?php echo site_url('css/datepicker.css'); ?>" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="<?php echo site_url('js/bootstrap.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo site_url('js/bootstrap-datepicker.js'); ?>"></script>
<?php if(isset($sortable) && $sortable === TRUE): ?>
<script src="<?php echo site_url('js/jquery-ui-1.9.1.custom.min.js'); ?>"></script>
<script src="<?php echo site_url('js/jquery.mjs.nestedSortable.js'); ?>"></script>
<?php endif; ?>
Please Somebody help me, please make it file .js working
Use base_url instead of site_url.
For example, replace this...
<script src="<?php echo site_url('js/bootstrap.min.js'); ?>"></script>
...with this...
<script src="<?php echo base_url('js/bootstrap.min.js'); ?>"></script>
Do this for all link and script tag declarations in your head.
From the Codeigniter documentation:
site_url(): Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your site index_page in your config file) will be added to the URL, as will any URI segments you pass to the function, and the url_suffix as set in your config file.
base_url(): Returns your site base URL, as specified in your config file. (...) This function returns the same thing as site_url, without the index_page or url_suffix being appended.
I am running on Magento 1.7 and its a fresh copy.
What I want to achieve:
On pageload of the website, display the newsletter template block
{{block type="newsletter/subscribe" template="newsletter/subscribe.phtml"}}
as a pop-up window in Magento once, where the cookies will expire after a given period of time eg: 1 week.
The answers on web are either not specific, or not detailed enough as my knowledge is not broad on scripts.
What I tried so far:
attempt to add a lightbox:
1) Add Lightbox CSS & JS
<script type="text/javascript" src="<?php echo $this->getJsUrl('lightbox/lightbox.js'); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->getJsUrl('lightbox/lightbox.css'); ?>" media="screen"/>
2) In view.phtml I added a link
Size chart
The lightbox is working but the static block is not called... still figuring out how to call a static box..
I have successfully called a popup consisting static block using the steps below.
http://jsfiddle.net/5USUu/
So basically we need to:
Add .js and .css files - I'm using colorbox
Define the function
Call the function
1) Add the following script in header
<link rel="stylesheet" type="text/css" href="<?php echo $this->getJSUrl('pop/colorbox.css'); ?>" media="screen"/>
<link rel="stylesheet" type="text/css" href="<?php echo $this->getJSUrl('pop/popup.css'); ?>" />
<script language="javascript" src="<?php echo $this->getJSUrl('pop/colorbox.js'); ?>"></script>
<script>
jQuery(document).ready(function (){
if (document.cookie.indexOf('visited=true') == -1){
var fifteenDays = 1000*60*60*24*15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
jQuery.colorbox({width:"580px", inline:true, href:"#subscribe_popup"});
}
jQuery(".open_popup").colorbox({width:"580px", inline:true, href:"#subscribe_popup"});
});
</script>
2) Add this link in html that link to your pop up
Click here to open the popup
3) Add the html that contains your static block identifier
<div style='display:none'>
<div id='subscribe_popup' style='padding:10px;'>
<!-- BEGIN #subs-container -->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('subscribe')->toHtml() ?>
<div id="subs-container" class="clearfix"> </div>
</div>
</div>
<!-- END subscribe popup-->
I am trying to add a calender in my application. The following code that I have is not working in codeigntier but it works fine if I put it into another folder outside codeigniter. Would you please kindly help me find out what the problem is?
Thanks in Advance
<html>
<head>
<link href="calendar/calendar.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="calendar/calendar.js"></script>
</head>
<body>
<?php
//get class into the page
require_once('tc_calendar.php');
$myCalendar = new tc_calendar("date5", true, false);
$myCalendar->setIcon ("calendar/images/iconCalendar.gif");
$myCalendar->setDate(date('d'), date('m'), date('Y'));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(1971, 2035);
$myCalendar->dateAllow('1971-01-01', '2035-01-01');
$myCalendar->setDateFormat('j F Y');
//$myCalendar->setHeight(350);
//$myCalendar->autoSubmit(true, "form1");
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->writeScript();
?>
</body>
</html>
It's likely that the paths to your assets are off. Try using base_url() in the calls to your assets and see if that helps. Your JS and CSS files would be loaded like this:
<link href="<?php echo base_url(); ?>calendar/calendar.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<?php echo base_url(); ?>calendar/calendar.js"></script>
base_url() will get you to the root of the application, so if the calendar directory is not at the root then update that path accordingly. Inspect the HTML that is produced and see if it is actually loading the assets.