setCustomUrl and $_GET['piwik_campaign']


(heinetz) #1

hi,

i want to use the campaign-feature but I also have to set CustomUrl.
the parameter wont work anymore, when I’ve set a CustomUrl.

i’ve no idea. Is there any solution ?

is it possible to track a request /?piwik_campaign=my_campaign only
in campaigns without displaying in actions/pages f.e. ? or track the
request per js without trackPageView.

thank you for tips and

best,
hienetz


(vipsoft) #2

If you use setCustomUrl(), you have to put your campaign parameters in the custom URL.


(heinetz) #3

shure, that’s been the first thing I tried style_emoticons/<#EMO_DIR#>/wink.gif

my code:

if (isset($_GET['piwik_campaign'])) $piwik_CustomUrl=$_SERVER['REQUEST_URI'];

//Versuch mit symlink
$piwik_domain = $_SERVER['SERVER_NAME'];
$piwik_str = '
<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://'.$piwik_domain.'/_piwik/" : "http://'.$piwik_domain.'/_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);';

if (isset($piwik_CustomUrl)) $piwik_str.= '
piwikTracker.setCustomUrl("'.$piwik_CustomUrl.'");
';

$piwik_str.= '
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://'.$piwik_domain.'/_piwik/piwik.php?idsite=1" style="border:0" alt=""/></p></noscript>
<!-- End Piwik Tag -->
';

so the generated js looks like this:

piwikTracker.setCustomUrl("/Unsere_Leistungen/?piwik_campaign=NEU&piwik_kwd=klicked");

or do you meen s.t. else ?

thanks,
best,
heinetz


(Matthieu Aubry) #4

true, I think however that this is a limitation we could fix. I created a ticket: http://dev.piwik.org/trac/ticket/1198


(vipsoft) #5

That’s not a URL.


(heinetz) #6

ok, now I see.

thank you!

best,
heinetz