Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

Configuring Mint for Expression Engine

Shaun Inman
Mint/Pepper Developer
Posted on Jan 28, '07 at 02:15 am

This howto was originally contributed by davidjaymz

To install Mint with Expression Engine is relatively straightforward.

First thing you need to do is decide whether your gonna run your Mint install from EE’s db or from its own db. Either way you need to know four things.

  1. MySQL Database Name
  2. MySQL Server Address (often “localhost” or the server IP address)
  3. MySQL Username
  4. MySQL Password

If your going to install to the same db you’ve installed EE then the db info can be found in your config.php file in your system folder. Lines 11 to 14 should have the following info

$conf['db_hostname'] = "DB_HOST";
$conf['db_username'] = "DB_LOGIN";
$conf['db_password'] = "DB_PASSWORD";
$conf['db_name'] = "DB_NAME";

Mint’s configuration file is located in the /config/ folder of your Mint install; it is called db.php. You will need to open it and set the following values using the information above, either from your EE install or your new db info. Of course you will need to keep the table prefix values so Mint does not overwrite any EE tables.

'server'    => 'DB_HOST,
'username'  => 'DB_LOGIN',
'password'  => 'DB_PASSWORD',
'database'  => 'DB_NAME',

Now that your Mint configuration file is ready, you can upload the folder to your web site as per the instructions. Browsing to this folder should walk you through the remaining install process.

Once Mint is installed the last step that remains is adding the JavaScript Mint needs to run to the pages you want statistics logged for.

For Expression Engine there are two ways to go about this.

One: You can put the call code into your root index.php file. This index.php file is the main starting point for your site. Every page runs through it so you’ll be able to log info from every single page.

Opening up the index.php page you’ll see a section of copyright info just pop the following line of code below that (after the closing comment */)

include_once($_SERVER["DOCUMENT_ROOT"]."/mint/config/auto.php");

This will put the JS call into your header below the <title> tag. Once you’ve done that reupload the file and surf to any of your pages. Check the source and you should see the call like this

<script src="/mint/?js" type="text/javascript"></script></head>

Two: The other way to log your pages is to put the mint JavaScript into your templates. This is useful if you only want to log hits on certain pages. Again this is very straightforward. Using the EE Control panel just surf to your templates and open the relevant template and place the following code just above the </head> tag and below the <title> tag.

<script src="/mint/?js" type="text/javascript"></script>

Save the template and surf to one of the relevant pages and check the source to see that it has been inserted correctly.

If the code is in the right place then your ready to start tracking your stats.

The code snippets above assume you’ve installed Mint at the root of your site. you may have to tweak the code if you’ve placed Mint someplace else.

Hope this helps you get started with Mint and EE.

I’ve installed Mint using the tag included in the embedded header on every EE template. Everything is working nicely, except that all the “From” sections of the Pages stats box only indicate “/”, not the correct complete URL. The titles are showing up correctly, however if I click on one of them I get directed to the “index.php” file and not the actual page: “index.php/templategroup/page”. Any ideas? Thanks.

Nevermind… I kicked around a bit and figured it out. I needed to uncheck the global option “Trim www and index.* from urls (This will logically collapse two different urls that point to the same file. May break some urls.)” Everything is working correctly now. Great app by the way.

Trying to be smart about this, but not having much luck.

i want to be able to track hits to every entry, not just to the main index page.

Adding the call code manually to the index.php file (ftping onto the server and doing it there) does not put the js call anywhere on my pages. i do it, i reload, i check view source and the js code is nowhere to be found.

if i add the mint js to the entry section of the index template, then i’ll record a hit to EVERY entry that’s present on the front page. every single time someone arrives.

if i put the js code in the header as noted above, i don’t get hits to full post pages (e.g., if someone arrives to a post via search engine or referral from another site).

i am sorry for being idiotic here, but this is a new redesign and i’m a new licensee and i’m excited about the tool, but right now it doesn’t seem to allow me to do something i was able to hack MT and site meter to do for me. i am sure i am missing something basic. i also apologize that i am new to EE as well. if there’s a place i can go RTFM to be smarter about this, feel free to point me in that direction.

thanks in advance.

update - well, i sorted it through trial and error, and now it’s working (using the method of inserting the call code to index.php). brilliant.

for those who might run into the same problem - the otherwise massively helpful text above references “you’ll see a section of copyright info just pop the following line of code below that” - that’s not quite accurate. right underneath the copyright info, you’ll see a line break that looks like this:

if you insert the code there, nothing will happen. however, the next line has */ and if you insert the code underneath THAT, voila.

perhaps this is obvious if you’re a hardcore PHP coder but I am not.

Ah sorry metsgrrl.

It sounds like originally your were putting the call code inside of the copyright comment rather than after it.

the */ is the closing tag of the comment so after that is a good location for the call.

Maybe shaun can edit the post to clarify.

Just a quick question from me…when I put the Mint call into index.php I get this:

I am not getting the language=”javascript” part.

Is that bad? :)

Shaun Inman
Mint/Pepper Developer
Posted on Apr 18, '07 at 06:04 pm

No, language=”javascript” was removed from Mint. The example above is just a hold over from a previous version. Nothing to worry about. I’ll update the post now.

Is it correct to assume if i have Mint going in one tab and surf to my site from another tab (same browser) that mint will not record my actions.

Panji
Guest
Posted on Aug 31, '08 at 12:58 pm

thanks for this thread, i’ll try later on my ee once published

wired
Minted
Posted on Oct 11, '08 at 01:52 pm

Thanks First solution is working as a charm…

Leads
Minted
Posted on Dec 15, '08 at 05:50 am

Hi all.

I installed this on my expressionengine site and it started working fine.

But now my stats don’t show any visitors for last 3 weeks. And I also get a script error in Internet Explorer. WHen I remove the mint stats line, there is no error.

http://tomleadbetter.co.uk

I use Expression Engine and I just installed Mint and it does not seem to be recording any visits. I installed Mint with its own db, and the db is completely empty. Here’s the site I’m trying to track: http://thegarmentor.com

Is the problem perhaps related to the fact that if I visit http://thegarmentor.com/mint it shows my homepage instead of the mint folder’s index.php file? I don’t seem to be able to change any of the Preferences either because when I hit “Done” it redirects me to a version of my homepage (a la http://thegarmentor.com/mint).

Thanks in advance.

Shaun Inman
Mint/Pepper Developer
Posted on Dec 17, '08 at 02:59 pm

Try disabling mod_rewrite in the Mint directory.

Worked like a charm. Thanks, Shaun. :)

Hi, Just installed Mint and all went well. However when I view stats in Mint: wabisabi-press.co.uk/mint I see no data at all. I am using Expression Engine and have entered the correct db info. What is going wrong.

should I try to disable mod_rewrite and how do I find this? Thanks in advance. Graham

Nutmeg
Minted
Posted on Oct 28, '09 at 03:57 am

Would like an answer similar to Wabi Sabi Press, please!

Shaun Inman
Mint/Pepper Developer
Posted on Oct 28, '09 at 09:39 am

Try using the Mint query commands (particularly ?errors and #Mint:Debug) to determine the cause of the issue.

dmd.
Minted
Posted on Feb 22, '10 at 02:32 am

would i just have to add <script src="/mint/?js" type="text/javascript"></script> into my RSS template for that to work as well?

Shaun Inman
Mint/Pepper Developer
Posted on Feb 22, '10 at 09:33 am

No. Take a look at the Bird Feeder Pepper and see if EE has any plugins to simplify integrating Bird Feeder.

Just going back to the top, in method one, if you have renamed your index.php file to tidy up your urls, then you need to insert the code as described into the renamed file in your root folder.

I’d forgotten I’d done this and so it just took me about 10 minutes of wondering how come it wasn’t working until the lightbulb came on.

But now it is working I’m getting multiple hits from each page - I presume this is because my design within EE is calling multiple templates at once so the code is appearing as many as eight times on one page.

So unless anyone has any bright ideas, I’m going to go to method two … which will take me yonks, as we say in this part of England!

CCZ
Minted
Posted on Sep 17, '11 at 10:16 pm

Hi! I’m running EE2. Installed Mint with no issues. Tested with a different browser to get some page hits registered.

Unfortunately, all hits are showing up just for my main homepage: zionsvillelutheran.org

Meaning if I visit any of the following URLs: zionsvillelutheran.org/index.php/mops/index zionsvillelutheran.org/index.php/news/index

I just get multiple hits on zionsvillelutheran.org

I was hoping to get per-template stats. Help? Do my pages have to have unique titles, to register as different pages in Mint?

CCZ
Minted
Posted on Sep 17, '11 at 11:42 pm

Never mind….. johnnydanger’s tip above about unchecking the MINT option (not EE option) to trim URLs worked for me….. I think I’m good now!

You must be logged in to reply. Login above or create an account