@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Page; |
| 18 | 18 | |
| 19 | 19 | // Init class autloading. |
| 20 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
| 20 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
| 21 | 21 | |
| 22 | 22 | // Include Utils.php - a file containing helper functions |
| 23 | -include dirname(__FILE__) . '/../Utils.php'; |
|
| 23 | +include dirname(__FILE__).'/../Utils.php'; |
|
| 24 | 24 | |
| 25 | 25 | // Read project ID from command line. |
| 26 | -if ($argc!=2) { |
|
| 27 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
| 26 | +if ($argc != 2) { |
|
| 27 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
| 28 | 28 | } |
| 29 | 29 | $projectId = $argv[1]; |
| 30 | 30 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // Save access token for later use |
| 64 | 64 | $accessToken = $optimizelyClient->getAccessToken(); |
| 65 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
| 65 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
| 66 | 66 | |
| 67 | 67 | echo "Done!\n"; |
| 68 | 68 | |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | use WebMarketingROI\OptimizelyPHP\Exception; |
| 17 | 17 | |
| 18 | 18 | // Init class autloading. |
| 19 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
| 19 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
| 20 | 20 | |
| 21 | 21 | // Include Utils.php - a file containing helper functions |
| 22 | -include dirname(__FILE__) . '/../Utils.php'; |
|
| 22 | +include dirname(__FILE__).'/../Utils.php'; |
|
| 23 | 23 | |
| 24 | 24 | // Read project ID from command line. |
| 25 | -if ($argc!=2) { |
|
| 26 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
| 25 | +if ($argc != 2) { |
|
| 26 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
| 27 | 27 | } |
| 28 | 28 | $projectId = $argv[1]; |
| 29 | 29 | |
@@ -47,18 +47,18 @@ discard block |
||
| 47 | 47 | $pages = $result->getPayload(); |
| 48 | 48 | |
| 49 | 49 | foreach ($pages as $pageEntity) { |
| 50 | - echo "Id: " . $pageEntity->getId() . "\n"; |
|
| 51 | - echo "Name: " . $pageEntity->getName() . "\n"; |
|
| 52 | - echo "Edit URL: " . $pageEntity->getEditUrl() . "\n"; |
|
| 50 | + echo "Id: ".$pageEntity->getId()."\n"; |
|
| 51 | + echo "Name: ".$pageEntity->getName()."\n"; |
|
| 52 | + echo "Edit URL: ".$pageEntity->getEditUrl()."\n"; |
|
| 53 | 53 | echo "\n"; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Determine if there are more projects. |
| 57 | - if ($result->getNextPage()==null) |
|
| 57 | + if ($result->getNextPage() == null) |
|
| 58 | 58 | break; |
| 59 | 59 | |
| 60 | 60 | // Increment page counter. |
| 61 | - $page ++; |
|
| 61 | + $page++; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | } catch (Exception $e) { |
@@ -72,6 +72,6 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // Save access token for later use |
| 74 | 74 | $accessToken = $optimizelyClient->getAccessToken(); |
| 75 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
| 75 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
| 76 | 76 | |
| 77 | 77 | echo "Done!\n"; |
@@ -55,8 +55,9 @@ |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Determine if there are more projects. |
| 58 | - if ($result->getNextPage()==null) |
|
| 59 | - break; |
|
| 58 | + if ($result->getNextPage()==null) { |
|
| 59 | + break; |
|
| 60 | + } |
|
| 60 | 61 | |
| 61 | 62 | // Increment page counter. |
| 62 | 63 | $page ++; |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | use WebMarketingROI\OptimizelyPHP\Exception; |
| 17 | 17 | |
| 18 | 18 | // Init class autloading. |
| 19 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
| 19 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
| 20 | 20 | |
| 21 | 21 | // Include Utils.php - a file containing helper functions |
| 22 | -include dirname(__FILE__) . '/../Utils.php'; |
|
| 22 | +include dirname(__FILE__).'/../Utils.php'; |
|
| 23 | 23 | |
| 24 | 24 | // Read project ID from command line. |
| 25 | -if ($argc!=2) { |
|
| 26 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
| 25 | +if ($argc != 2) { |
|
| 26 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
| 27 | 27 | } |
| 28 | 28 | $projectId = $argv[1]; |
| 29 | 29 | |
@@ -47,17 +47,17 @@ discard block |
||
| 47 | 47 | $campaigns = $result->getPayload(); |
| 48 | 48 | |
| 49 | 49 | foreach ($campaigns as $campaign) { |
| 50 | - echo "Name: " . $campaign->getName() . "\n"; |
|
| 51 | - echo "Status: " . $campaign->getStatus() . "\n"; |
|
| 50 | + echo "Name: ".$campaign->getName()."\n"; |
|
| 51 | + echo "Status: ".$campaign->getStatus()."\n"; |
|
| 52 | 52 | echo "\n"; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Determine if there are more campaigns. |
| 56 | - if ($result->getNextPage()==null) |
|
| 56 | + if ($result->getNextPage() == null) |
|
| 57 | 57 | break; |
| 58 | 58 | |
| 59 | 59 | // Increment page counter. |
| 60 | - $page ++; |
|
| 60 | + $page++; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | } catch (Exception $e) { |
@@ -71,6 +71,6 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // Save access token for later use |
| 73 | 73 | $accessToken = $optimizelyClient->getAccessToken(); |
| 74 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
| 74 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
| 75 | 75 | |
| 76 | 76 | echo "Done!\n"; |
@@ -53,8 +53,9 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Determine if there are more campaigns. |
| 56 | - if ($result->getNextPage()==null) |
|
| 57 | - break; |
|
| 56 | + if ($result->getNextPage()==null) { |
|
| 57 | + break; |
|
| 58 | + } |
|
| 58 | 59 | |
| 59 | 60 | // Increment page counter. |
| 60 | 61 | $page ++; |
@@ -42,26 +42,26 @@ |
||
| 42 | 42 | $campaign = new Campaign(array( |
| 43 | 43 | "project_id" => $projectId, |
| 44 | 44 | "changes" => array( |
| 45 | - array( |
|
| 45 | + array( |
|
| 46 | 46 | "type" => "custom_code", |
| 47 | 47 | "value" => "window.someGlobalFunction();" |
| 48 | - ) |
|
| 48 | + ) |
|
| 49 | 49 | ), |
| 50 | 50 | "experiment_ids" => array( |
| 51 | - 0 |
|
| 51 | + 0 |
|
| 52 | 52 | ), |
| 53 | 53 | "holdback" => 0, |
| 54 | 54 | "metrics" => array( |
| 55 | - array( |
|
| 55 | + array( |
|
| 56 | 56 | "aggregator" => "sum", |
| 57 | 57 | "event_id" => 0, |
| 58 | 58 | "field" => "revenue", |
| 59 | 59 | "scope" => "session" |
| 60 | - ) |
|
| 60 | + ) |
|
| 61 | 61 | ), |
| 62 | 62 | "name" => "Landing Page Optimization", |
| 63 | 63 | "page_ids" => array( |
| 64 | - $pageId, |
|
| 64 | + $pageId, |
|
| 65 | 65 | ), |
| 66 | 66 | "status" => "not_started", |
| 67 | 67 | "type" => "a/b" |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Campaign; |
| 18 | 18 | |
| 19 | 19 | // Init class autloading. |
| 20 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
| 20 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
| 21 | 21 | |
| 22 | 22 | // Include Utils.php - a file containing helper functions |
| 23 | -include dirname(__FILE__) . '/../Utils.php'; |
|
| 23 | +include dirname(__FILE__).'/../Utils.php'; |
|
| 24 | 24 | |
| 25 | 25 | // Read project ID from command line. |
| 26 | -if ($argc!=3) { |
|
| 27 | - die('Expected 2 command-line argument, while got ' . $argc-1); |
|
| 26 | +if ($argc != 3) { |
|
| 27 | + die('Expected 2 command-line argument, while got '.$argc - 1); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $projectId = $argv[1]; |
@@ -81,6 +81,6 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | // Save access token for later use |
| 83 | 83 | $accessToken = $optimizelyClient->getAccessToken(); |
| 84 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
| 84 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
| 85 | 85 | |
| 86 | 86 | echo "Done!\n"; |