Rewriting array parameters into regular parameters

Extra Tokens with "-" in the parameter name will work in CPV Lab Pro.


  • you can define the following token:

    • Name: Token1
    • URL Append: &your-name={name}
    • Parameter: your-name
  • CPV Lab Pro will capture correctly the values passed instead of the {name} placeholder.

  • You can even use "_" in the parameter name, so an Extra Token for the "your_name" parameter will also work.

  • But the array parameters like "form_fields[yourname]" will NOT work because these are not standard parameters.

    • If you need to capture such parameters you can use a temporary page that will convert from array parameters to regular parameters and add this page before the Campaign URL (base.php page). This can be done with PHP or any programming language.

Rewrite-parameters.php Page

  • We have created a PHP page that will rewrite parameters from their array form (with "[" and "]" signs) to the regular format that can be captured in CPV Lab Pro. The page can be customized to work with any parameters you need. You can download the page from here

  • The main idea is that this page can rewrite a parameter like "form_fields[yourname]" into "yourname".

You need to follow the steps below in order to rewrite parameters.

  • In my example I'm rewriting "yourname" and "yourage" from the array form to the regular form.

Step 1. Setup the Extra Tokens in your campaign with the array form in the URL Append box and with the simple parameter form in the Parameter box, like this:

Rewrite Parameters Extra Tokens

Step 2. Take your Campaign URL from the   Campaign Setup page which should look like this:


Step 3. Replace "base.php" with the name of the rewrite page,   "rewrite-parameters.php":


Step 4. Edit the rewrite page (rewrite-parameters.php) and make the following configurations:

  • define in the $rewriteParams variable "form_fields" as the array to read from and the 2 keys that should be rewritten: "yourname" and "yourkey"
  • define in the $dontPassParams array the "form_fields" value in order to not pass the entire array in the redirect
  • define the $redirectUrl variable to be the "base.php" page (the Campaign URL)

Rewrite Parameters

Step 5. Upload the rewrite page (rewrite-parameters.php) in the root of your   CPV Lab Pro instance.

  • Now you will submit the Campaign URL with the rewrite-parameters.php page to your Traffic Source. This is the URL from Step 3 above.

  • The Traffic Source will send traffic to the rewrite-parameters.php page, then this page will rewrite the parameters specified in the configuration at Step 4 and redirect to the Campaign URL (base.php page) with the standard parameters that can be captured in Extra Tokens.

  • And this is all you need to do in order to change from array parameters to regular parameters that can be stored in Extra Tokens.

  • Of course you can configure the parameter names and the page names as you wish.