Custom Macro Script

Available in Pro edition only

How to create a macro script

Directory for macro scripts /application/macros/.

To add new macro, we'll create a file /application/macros/randomx.php with code:

namespace Macros;
use Traffic\Model\BaseStream;
use Traffic\RawClick;
use Traffic\Macros\AbstractClickMacro;
class randomx extends AbstractClickMacro
    public function process(BaseStream $stream, RawClick $click, $min, $max)
        return rand($min, $max);

Make sure that class name and file name are the same.

In order to send parameters to macro script, just specify in macro:


It will send $min = 100 and $max = 999

To read more about $stream and $rawClick read page Internals.