[SOLVED] Open Web Analytics - Need PHP script on all pages

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
SlidingHorn
Regular
Posts: 18
Joined: Wed Jul 28, 2010 6:14 pm

[SOLVED] Open Web Analytics - Need PHP script on all pages

Post by SlidingHorn »

I'd like to install Open Web Analytics for the site I'm working on, and all I need to do (as far as I know) is include the following PHP script on all pages of the site:

Code: Select all

<?php
    require_once('owa_env.php');
    require_once(OWA_DIR.'owa_php.php');
    $owa = new owa_php();
    $owa->setSiteId('your_site_id');
    $owa->setPageTitle('My Web Page Title');
    $owa->setPageType('article');
    $owa->trackPageView();
?>
I have 2 questions:

1. What's the best way to accomplish this?

2. I assume I'd have to replace the "your_site_id", "My Web Page Title", and "article" with some sort of already-present s9y variables?
Last edited by SlidingHorn on Sun Feb 18, 2018 4:31 pm, edited 1 time in total.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Open Web Analytics - Need PHP script on all pages

Post by yellowled »

SlidingHorn wrote:1. What's the best way to accomplish this?

2. I assume I'd have to replace the "your_site_id", "My Web Page Title", and "article" with some sort of already-present s9y variables?
I'm not sure about the "best way" part of your question, so I'm going to leave that for Garvin or onli to answer, but

A. I'm pretty sure you'll have to at least adapt the path to the files you're requiring (assuming you'll have to upload or install them to your webspace as well, I'm not familiar with Open Web Analytics).
B. Pretty sure your site id, title and page type will be something "OWA internal". The title is obviously some kind of name for your blog, the id is probably some kind of unique identifier, and I'm not sure about the article, but you should get all these from your OWA installation, not from Serendipity.

YL
MarioH
Regular
Posts: 238
Joined: Mon Jul 20, 2009 10:53 pm
Contact:

Re: Open Web Analytics - Need PHP script on all pages

Post by MarioH »

Hi,
you can use the serendipity_event_page_nugget Plugin to place the code on all sites of your blog.

Regards
Mario
SlidingHorn
Regular
Posts: 18
Joined: Wed Jul 28, 2010 6:14 pm

Re: Open Web Analytics - Need PHP script on all pages

Post by SlidingHorn »

MarioH wrote:Hi,
you can use the serendipity_event_page_nugget Plugin to place the code on all sites of your blog.

Regards
Mario
I'm not seeing this plugin in SPARTACUS...I do see "HTML-Code inside head (HTML-Head Nugget)" and "HTML Nugget on Page", but my understanding is that these are for HTML only

EDIT: Now that the "Plugins" page on here is back up I see that "HTML Nugget on Page" is the one you're talking about, but I still thought those were only for HTML...can you clarify?
MarioH
Regular
Posts: 238
Joined: Mon Jul 20, 2009 10:53 pm
Contact:

Re: Open Web Analytics - Need PHP script on all pages

Post by MarioH »

You can use it for any kind of code. Just use the second "content" field.
Post Reply