Osclass forums
Support forums => Tips, tricks, and tutorials => Topic started by: jacosky on April 09, 2018, 10:34:46 pm
-
I want to run a CPA campaign to my site where I get to only pay for successful registrations. Please where can I locate the registration success page so that I can integrate the CPA tracking code?
Any help will be appreciated.
-
Hello,
You could use something like this:
<?php
function trackingCode($userId) {
// do something...
}
osc_add_hook('user_register_completed', 'trackingCode');
?>
Hook explanation (from https://doc.osclass.org/Hooks):
- Run after registration of a user is completed.
- $userId is passed as an argument.
Regards.
-
Thanks a lot Patrick but I'm not a techie, so please be patient with me.
In which file will I paste this code above?
Secondly, where will I paste my CPA tracking code generated from my ad network?
-
That code should be placed in functions.php of your theme (oc_content/themes/theme_name/functions.php), but it still does nothing. Could you provide your tracking code? Without it I don't know how you should implement it. If it's Javascript you can just do this:
<?php
function trackingCode($userId) {
echo "my tracking JS";
}
osc_add_hook('user_register_completed', 'trackingCode');
?>
Regards.
-
Thank you Patrick. This is my tracking code:
<!-- NG Adverts - Tracking Code -->
<script data-cfasync="false" type="text/javascript" src="//www.ngadverts.com/ng/display/index.php?page=click/conversion/1011"></script>
<!-- NG Adverts - Tracking Code -->
-
Just paste this into functions.php:
<?php
function trackingCode($userId) {
echo '<!-- NG Adverts - Tracking Code --><script data-cfasync="false" type="text/javascript" src="//www.ngadverts.com/ng/display/index.php?page=click/conversion/1011"></script><!-- NG Adverts - Tracking Code -->';
}
osc_add_hook('user_register_completed', 'trackingCode');
?>
Regards.