Forums » Developers



Goals via PHP postback

Hi,

I have some pages which I'm running dynamic split tests on. I want to track the number of users who click on a call-to-action button who are then redirected elsewhere using via a PHP script. The dynamic javascript split testing works alright though the use of onclick="clicky.goal( 'goalhere' ) is a bit sluggish and I need to add clicky.pause to get it to work decently.

I'd rather start a split test with javascript and then use a postback during the outbound PHP redirection to declare a goal for that split test being satisfied. So, how to do this properly? I have tried various methods based on the customized tracking/logging data manually sections but nothing seems to work as I want it. What I'm hoping is that you can simply pass site id, admin key, IP address, type=goal and goal[id] to get Clicky to realise that the person with that IP address just completed the goal which the split test is looking for, updating the split test/goals data and giving me results!

I have tried using:

$site_id = "12345678";
$sitekey_admin = "lotsofnumbersandstuffhere";
$ip = $_SERVER['REMOTE_ADDR'];

file("http://in.getclicky.com/in.php?site_id=".$site_id."&sitekey_admin=".$sitekey_admin."&ip_address=".$ip."&type=goal&goal%5Bid%5D=goalname");

And have also tried using a typical HttpRequest::METH_GET method, none working. Even if the split testing integration was failing I would've expected to see goals pop up on the spy page as I was testing it myself but I get absolutely nothing.

Help appreciated!

Posted Sun Sep 16 2012 11:03p by zen***


Nevermind, got it to work it seems. FYI if anyone is interested I am using the code as per the following link:

pastebin.com/gXg4sJdw

Note that the goal when triggered by the PHP postback, doesn't appear in the spy list but does appear in the goals/split test page. Will update here if I have any other issues since it may be useful to other people.

Posted Mon Sep 17 2012 12:53a by zen***


You must be logged in to your account to post!