Possible to track custom URL from Newspaper/Magazine ad?

Hi.

I would like to put an ad in a newspaper and record how many people actually use the URL

The link will be something like ‘mywebsite.com -&nbspThis website is for sale! -&nbspmywebsite Resources and Information.’ but I need to make the index file in the 2012 folder become a redirect and send people to the main domain entry page, and in the process record in Piwik the fact that their entry page was mywebsite.com -&nbspThis website is for sale! -&nbspmywebsite Resources and Information.

I’ve seen the odd tutorial doing this in GA but I want to use piwik as I’ve had it installed on my website for ages? I’ve looked up info on Goals & campaigns but can’t work out how to use it as a redirect.

Many thanks and I look forward to any advice offered.

Andrew

There are several solutions

  1. using tracking API, similarly to what is explaiend in this post: 301 Moved Permanently
  2. load an empty HTML page with the Piwik code in it, and do a HTML meta refresh redirection after 1 or 2 seconds (to leave time for Piwik beacon to load)

Thanks a lot for the info Matt and glad to hear I can use Piwik.

I looked at the tracking API section you mentioned and it all looks a little over my head with regards to customizing something for my needs.

I’ll give the empty html page with code and redirection a shot and see how that goes :wink:

Cheers.

Andrew

Great, if you manage to make it work, it’s appreciated if you can post a simple “How to track newspaper/TV ad with Piwik” in the forum: 301 Moved Permanently

Damn, I’m not as clever as I thought I was. How is that possible :slight_smile:

I’ve created the new folder titled 2012 on the root directory and inside the folder have a single file titled index.html with the following code in it.

(apologies but I had to rename the site to ‘mywebsite’ as it’s currently quite a private one until up and running correctly)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex", "nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="5;url=http://www.mywebsite.com">
<title>Demonstration</title>

<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.mywebsite.com/piwik/" : "http://www.mywebsite.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.setDocumentTitle(document.title);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://www.mywebsite.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
</head>

<body>
<p>&nbsp;</p>

You should be automatically redirected to the <a href="http://www.mywebsite.com">mywebsite</a> homepage within 5 seconds.


</body>
</html>

Using the url mywebsite.com -&nbspThis website is for sale! -&nbspmywebsite Resources and Information. the index page loads fine, hangs around for 5 seconds and then get redirected to the main homepage on the website but after many checks nothing is registered on the Piwik dashboard or any of the Widgets.

I tried it without the part piwikTracker.setDocumentTitle(document.title); also but still no luck

Any help would be appreciated please.

Thanks,

Andrew

Put the code in the ?

Silly me… I missed the obvious. It works now and I also have a goal set up to check for the title of the redirecting index page

Full working code is: (the winking smiley seems to be replacing the ; and )


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="robots" content="noindex", "nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="3;url=http://www.mywebsite.com">
<title>mydemo</title>
</head>

<body>

<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.mywebsite.com/piwik/" : "http://www.mywebsite.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.setDocumentTitle(document.title);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://www.mywebsite.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->
<p>&nbsp;</p>

You should be automatically redirected to the <a href="http://www.mywebsite.com">mywebsite.com</a> homepage within 3 seconds.


</body>
</html>

  • Note that the part where it says you can change the number ‘3’ to however many seconds you want. You could also add a small logo/image to the page just for people to look at.

Thanks again for your help Matt.

Why do you not just make a campaign in Piwik?

Using this tool:

http://piwik.org/docs/tracking-campaigns/url-builder/

Then you can very easy also make different tracking IDs to track different ads, and also set up goals - and see how much value each ad/ visitor brings you…

For instance a URL like this:
http://yoururl.com/landing-page?pk_campaign=Ad1

POS, such URL is not good to put in an ad/newspaper for people to type in their browser.

andrew222, please create a simple post with your final working prototype in this forum: 301 Moved Permanently
I’m sure other users will benefit from this tip!

Thanks anyway POS :wink:

Making the post now.

Well, redirecting a visitor with a meta refresh, while displaying a “please wait…” or an empty site is not a good idea either. Your bounce rate will quickly rise for sure.

  1. Why not sending your visitors to your main domain with a link, containing a parameter? “yourwebsite.com” - this is not worse than sending them to “yourwebsite.com” and redirecting them via a meta-refresh.

  2. You could also setup mod_rewrite to alias “yourwebsite.com” to “www.yourwebsite.com”.


RewriteRule ^/2012$   /$1 [L]

Should do the trick. (UNTESTET!!). This is the best solution but could produce “dupe content”. So you would have to exclude “/2012” via your robots.txt.

Hi Peter. Thanks for your input.

The client doesn’t want to print anything complicated in the brochure for the url (no question marks, numbers etc) and just wants something that’s easy to remember and the 2012 is just something to separate it from the main url and to track it as a goal. Future print advertising campaigns can use this same method by simply changing the name.

It’s bad enough that the website is actually built using the ‘nasty’ ModX cms which I soon hope to convert to Joomla.

I don’t believe that waiting 3 seconds would cause any raise in bounce rates due to the nature of the site (it’s a state park) although thinking about it perhaps I should add some sort of image on there for them to look at during their brief stay on the page. I may try it at 2 seconds to see if that works ok with Piwik.

Andrew

Hi Andrew,

thats why I posted solution 2).

Cheers
Peter

A ha.

Ok, I thought you meant an online newspaper.

I would definetly use htaccess as mentioned above, in combination with the URL I posted.

OR use your domain manager to make a subdomain that redirects to the URL I posted.

2012.yourdomain.com

BUT what is the main purpose of the AD itself? Getting people’s email address on the web page you send them to?

Hi POS,

Right, but nobody likes to enter a client side redirect URL. Also, if somebody shares the link online, someone will rather share a link to content, not a redirection link. So you could further track campaign success cross media.

Matt enhanced the idea for the htaccess solution:

  1. redirect “yourdomain.com/2012” to a piwik campaign link such as “yourdomain.com/?pk_capmaign=newspaperXY”. So people will only have to type in “yourdomain.com/2012” and you will be able to track campaign success. Something like (for example)

Redirect /2012 http://www.yourdomain.com/?pk_campaign=Tv-Ad-feb-12

Should do the job.

This is much cleaner than a client side redirect with meta refresh since this was deprecated a long time ago.

but nobody likes to enter a client side redirect URL.

That wasn’t my idea neither. I don’t like meta-refresh or javascript redirect myself :slight_smile: I suggested using htaccess as first mentioned by you. OR domain redirect (that is basically the same thing, but just another technique) to the Piwik campaign URL.

BUT if the main purpose is to get the email adress of the newspaper reader, I would suggest to go another route that has in many experiments worked much better:

Give something away for free.

Example:
Let’s say you are a local house painter. In your ad you could have written something like this: “Get the guide for better house oainting for free”. or “5 things you MUST know about when hiring a painter for your house” - then write: “Send a (blank) email to paintguide@mydomain.com - and you’ll receive it in you inbox immediately”

This has been tested in newspapers before, and done great.

The reason is that the conversion rate is 100% when using this method. (!00% of the ones that first respond to your ad signs up…)

The opposite is doing what it seams to me you are planning to do: Thinking of having an “offline” ad, that should get people to visit an online page. Then the visitors must add their email adress (and name?) to get acces to what you offer… Usually appr 10% of people coming to an online “opt in” page signs up. But in my example above ALL that sends you an email signs up…

Another case is that it is easier for me (using a smart phone) to send you an email, than opening a web page, read it - and then add my email adress etc in a “email box”.

Just my 2 cents and advice :slight_smile:

Sorry, I don’t get your point. Your problem was

And therefore, the .htaccess / campaign solution is best. No matter where your visitors come from (opt in eMail, offline, online, cross media, etc.). This has IMO nothing to do with marketing strategy but with performance analytics of whatever your marketing efforts may be.

Hi Peter.
I am POS, and I have not written that text you quote. That is written by the thread starter, and that is andrew222 :slight_smile:

[quote=Peter]
And therefore, the .htaccess / campaign solution is best.
[/quote] Yes, I agree. That is why I wrote : “I would definetly use htaccess as mentioned above, in combination with the URL I posted.” (that is the Piwik campaign URL)

Yes, it has. BUT you do performace analytics to get better at choosing the best strategy. And the solution with sending emails has shown before to be better all in all when using newsletter ads (offline) to collect email adresses. (As Andrew222 are going to.) It also is a great way to measure the performance, as you get complete stats (just not in Piwik :wink: ) - So my writing was just an advice to him.

The .htaccess/ campaign URL solution is the best “redirect solution” I know, together with the (sub-)domain forwarding to the same campaign URL. Meaning you can either use htaccess or the domain manager to set it up.:

http://mydomain.com/2012
or
http://2012.mydomain.com

Ooops, sorry, I got this wrong. At least, this was the problem I wanted to solve with the explained solution.

LOL :)-D

I think subdomain or htaccess is the best way too :slight_smile: