Advertisement:

Author Topic: CPA Tracking Code  (Read 853 times)

jacosky

  • Newbie
  • *
  • Posts: 3
CPA Tracking Code
« 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.

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: CPA Tracking Code
« Reply #1 on: April 09, 2018, 11:37:26 pm »
Hello,

You could use something like this:

Code: [Select]
<?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.

jacosky

  • Newbie
  • *
  • Posts: 3
Re: CPA Tracking Code
« Reply #2 on: April 10, 2018, 06:38:10 pm »
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?
« Last Edit: April 10, 2018, 06:39:50 pm by jacosky »

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: CPA Tracking Code
« Reply #3 on: April 10, 2018, 09:57:03 pm »
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:

Code: [Select]
<?php

function trackingCode($userId) {
    echo 
"my tracking JS";
}
osc_add_hook('user_register_completed''trackingCode');

?>


Regards.

jacosky

  • Newbie
  • *
  • Posts: 3
Re: CPA Tracking Code
« Reply #4 on: April 10, 2018, 10:15:38 pm »
Thank you Patrick. This is my tracking code:
Code: [Select]
<!-- 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  -->


WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: CPA Tracking Code
« Reply #5 on: April 11, 2018, 01:12:33 pm »
Just paste this into functions.php:

Code: [Select]
<?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.