Show Goal Targetting By URL as Well As By Keyword

The killer feature in Piwik is goal targetting for my money.

It works quite well, but it seems to me that there is a glaring omission in the reporting, namely that you can track goals by all these referrer types, but NOT by the url of a page.

View goals by Referrers

Keywords
Search Engines
Websites
Campaigns
Referrer Type

View goals by Visit

Country
Continent
Custom Variables

That doesn’t make a lot of sense, because it is on a page by page level that I want top track conversion changes, and whilst keywords gives some idea as to what page is causing the conversion, it isn’t always easy to figure out which keyword refers to which page (especially on a bigger site with roughly the same kinds of content).

Can a new targetting option be added into the next version of Piwik along the lines of:

“View Goals By URL”

So it is easy to see at a glance which pages on a website are actually generating all of the money?

That’s a reasonnable request. we do not currently do it for performance reasons, but alternatively you can use


piwikTracker.setCustomVariable(1, 'url', window.location.href);

This will set a custom var with the URL used, which you can then see conversion rates, etc. Custom Variables Analytics - Analytics Platform - Matomo

Hi Matt,

Great. Thanks. That’s appreciated.

I have now changed the bottom part of the tracking script from:


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.mydomain.com/piwik/" : "http://www.mydomain.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://www.mydomain.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->


To:


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.mydomain.com/piwik/" : "http://www.mydomain.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
piwikTracker.setCustomVariable(1, 'url', window.location.href);
} catch( err ) {}
</script><noscript><p><img src="http://www.mydomain.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->	

Is that right?

Any idea how much of a performance hit I should expect with this change?

Added: This code doesn’t seem to work. Have had 30 visitors to the site from search engines and a number of goals, but the custom variables area is showing as:

There is no data for this report.

Any idea what I need to change?

i have the same question as BigStu

so Matt, please reply

thanks

It should work, are you sure you are looking at the report for today ?

Custom variables is found in Visitors > Custom Variables

For me it doesn’t seem to work Matt.

Looking at my stats from yesterday on this particular domain. (I put the code on early, so there weren’t any conversions when I put it on.)

The site had 88 visitors (mainly from search engines), and showed 14 conversions in my Goals screen. (I have setup about 30 odd goals I think)

The custom variable is showing some stats. But they don’t seem to tally up.

Specifically, it is only showing 3 urls. And in the goals screen none of them have conversions.

I am not even sure what they refer to. They weren’t responsible for any goals. So they seem to be random?

Shouldn’t it show which urls were responsible for the 14 conversions?

Please use the latest RC, which has a few fixes regarding custom var: 301 Moved Permanently

After that hopefully the numbers will match as you would expect.

Hi Matt,

I upgraded to the final 1.6 release.

The numbers still don’t remotely match.

To explain the situation fully:

What I have on my website are mainly content pages which then have a zip submit on them. (These are the urls I want to know, because these are what led to the person putting in the zip code) - Page 1s…

These require the person to put in their zip code.

They then click submit, and they are then taken to another page on my site which lists more detailed information (adverts) pertaining specifically to exactly where they live. Page 2s (I don’t care about tracking these, because the goals report already tells me how many times these pages were visited. Its redundant information. When they visit these pages it triggers a goal being recorded.)

What I wanted to know in terms of the process goes something like this:

1/ Someone goes to Google.com and searches for ‘red widgets’.
2/ They see my page come up in the results and they click through. (To Page 1s)
3/ One of three things happen:

1 - They leave the site without doing anything in terms of the zip submits which I am tracking as goals.
2 - They see the zip submit at the top of that page (Page 1s) and put in their zip code and click submit (a ‘goal’ in piwik terms) - They then get taken to a Page 2, where they either click on a ad, or they don’t. Up to them.
3 - They read the pages content, but need more information, so they surf around the other pages on the site, and eventually put their zip code in on another page once they have satisfied themselves it can be helpful (a ‘goal’)

Yesterday I had 13 goals recorded on the goals page.

They are on quite different areas of interest. Five different ones to be exact.

Lets call them A, B, C, D and E.

Each had the following number of conversions:

A - 1
B - 2
C - 6
D - 3
E - 1

Yet, the custom variable is only showing 8 urls in total.

Of these 2 urls are from a totally different section on the site F. These are ‘Page 1’ type urls, but neither of them have ANY zip submits on them, so cannot possibly have led to a goal directly.

Unless this custom variable you suggested is tracking the entrance page only? And that is supposedly the page they entered the site with? (Possible. But still very doubtful, given the pages have very little to do with topics A - E)

Even so. I really want to know the ACTUAL url that led to them feeling comfortable enough to put in their zip and trigger a goal.

Of the remaining six, none of them are Page 1 urls. They are all Page 2 urls ie the urls of the pages AFTER they have put in their zip code.

Four C’s and Two D’s. BUT only the Page 2 pages which I already know. And no Page 1 urls.

Also, in all cases the custom variables on the goal screens is showing as $0 revenue. Which is odd, as ALL of my goals have cash amounts associated with them, and the 13 goal conversions ARE clearly show as having a value on the goals screen, and with all the other elements like keywords etc.

So:

I am not sure what this is tracking, but its not the page that led to the conversion.

And clearly it is missing information as there are 13 goals (ie the Page 2 was recorded as having been visited) but only 8 custom variables, and no associated revenue.

I am using the latest 1.6 version. So its not that.

Hence two thoughts:

1/ What do I need to change to get this to show the url that led to the conversion Matt?

2/ I wonder if custom variables is working correctly in the code? As this doesn’t seem to be tracking correctly, regardless of the criteria it is supposed to be tracking.

Sorry your message is long and I don’t really understand everything.

If it helps, Custom Variables for a “Goal” is the LAST value of the Custom Varible for the visit, just before the goal was triggered.

Otherwise, the best way to understand what Piwik is doing is to look at your Mysql tables piwik_log_visit and piwik_log_conversion, there you will see exactly what is being tracked and hopefully you will understand the problem if any.

Hi Matt,

The reason I went into such detail is because I think that there is an error with the way Piwik is tracking.

Three main problems:

1/ 8 does not equal 13.

2/ $0 does not equal the actual amount of revenue.

3/ There is no logic to what is showing up as the 8 urls.

Piwik is a tracking application.

If the tracking isn’t accurate (and this suggests on some level it isn’t at least when it comes to custom variables) then what else is not being tracked properly?

PS I don’t want to display my url here for competitive reasons, but if you think it would help, I would be happy to do a camtasia video for your eyes only, where I could record the screen as I look at the stats and explain the discrepancy. (If you let me know what your email is)

I think there is a problem with the way Piwik is tracking custom variables.

Any feedback on this Matt?

This custom variable string above doesn’t work.

Either the string is wrong and I need to put something else in. In which case what?

Or something about the way custom variables operates in 1.6 does not work. In which case I would appreciate knowing that so I can either remove the code or use a workaround.

Which is it?

Thanks.

the best way to understand what Piwik is doing is to look at your Mysql tables piwik_log_visit and piwik_log_conversion, there you will see exactly what is being tracked and hopefully you will understand the problem if any.