PHP code example of collinped / aimtell-php

1. Go to this page and download the library: Download collinped/aimtell-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

collinped / aimtell-php example snippets

bash
composer 
 php
$aimtell = new Collinped\Aimtell($apiKey, $defaultSiteId, $whiteLabelId);

$site = $aimtell->site()
                ->create([
                    'name' => 'Sample Website',
                    'url' => 'collinped.com'
                ]);

$campaigns = $aimtell->site($siteId)
                     ->campaign()
                     ->all();

$campaign = $aimtell->site($siteId)
                    ->campaign()
                    ->find($campaignId);
 php
$aimtell = $aimtell->getApiKey();
 php
$aimtell = $aimtell->setApiKey($apiKey);
 php
$aimtell = $aimtell->getDefaultSiteId();
 php
$aimtell = $aimtell->setDefaultSiteId($defaultSiteId);
 php
$aimtell = $aimtell->getWhiteLabelId();
 php
$aimtell = $aimtell->setWhiteLabelId($whiteLabelId);
 php
$websites = $aimtell->site()
                    ->all();
 php
$website = $aimtell->site()
                   ->find($siteId);
 php
$website = $aimtell->site($siteId)
                   ->getCode();
 php
$websites = $aimtell->site($siteId)
                    ->getSettings();
 php
$websites = $aimtell->site($siteId)
                    ->updateSettings([
                        ...
                    ]);
 php
$websites = $aimtell->site($siteId)
                    ->updatePackage();
 php
$websites = $aimtell->site($siteId)
                    ->delete();
 php
$websites = $aimtell->site($siteId)
                    ->getKeys();
 php
$websites = $aimtell->site($siteId)
                    ->upsertKeys([
                        ...
                    ]);
 php
$subscribers = $aimtell->site($siteId)
                       ->subscriber()
                       ->all();
 php
$subscriber = $aimtell->site($siteId)
                      ->subscriber()
                      ->find($subscriberId);
 php
$subscriber = $aimtell->site($siteId)
                      ->subscriber($subscriberId)
                      ->trackEvent([
                          'category' => '' // Required
                          'action' => '', // Required
                          'label' => '',
                          'value' => 1.00
                      ]);
 php
$subscriber = $aimtell->site($siteId)
                      ->subscriber($subscriberId)
                      ->optOut();
 php
$segments = $aimtell->site($siteId)
                       ->segment()
                       ->all();
 php
$segment = $aimtell->site($siteId)
                       ->segment()
                       ->find($segmentId);
 php
$segment = $aimtell->site($siteId)
                       ->segment()
                       ->create([
                           'name' => 'Segment Name'
                           'definition' => 'city==Irvine' // See Aimtell Docs
                       ]);
 php
$segment = $aimtell->site($siteId)
                       ->segment($segmentId)
                       ->update([
                           'name' => 'Segment Name'
                           'definition' => 'city==Irvine' // See Aimtell Docs
                       ]);
 php
$segment = $aimtell->site($siteId)
                       ->segment($segmentId)
                       ->delete();
 php
$results = $aimtell->site($siteId)
                   ->segment($segmentId)
                   ->getResultsByDate([
                       'startDate' => '1/1/2020',
                       'endDate' => '1/30/2020'
                    ]);
 php
$welcomeNotification = $aimtell->site($siteId)
                               ->welcomeNotification()
                               ->get();
 php
$results = $aimtell->site($siteId)
                   ->welcomeNotification()
                   ->getResultsByDate([
                       'startDate' => '1/1/2020',
                       'endDate' => '1/30/2020'
                    ]);
 php
$campaigns = $aimtell->site($siteId)
                     ->campaign()
                     ->all();
 php
$campaign = $aimtell->site($siteId)
                    ->campaign()
                    ->find($campaignId);
 php
$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->getClicks();
 php
$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->getResultsByDate([
                        'startDate' => '01/01/2020',
                        'endDate' => '02/15/2020',
                    ]);
 php
$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->create([
                        'name' => 'Campaign Name', // Required
                        'title' => 'Campaign Title',
                        ...
                    ]);
 php
$campaign = $aimtell->site($siteId)
                    ->campaign($campaignId)
                    ->delete();