pmmotors/pm-analytics-package

Project to manage the analytics

1.1 2021-07-13 22:04 UTC

This package is auto-updated.

Last update: 2024-11-08 06:13:39 UTC


README

Library for managing analytics and be installed in another projects

CONFIGURATION FOR DEVELOP IN THIS PROJECT:

SET UP

  • Clone this repository

  • Create the .env file with the correct values.

  • Add the adwords.ini file

  • Create container:

    docker-compose up -d
  • Access the container:
    docker-compose exec php-apache bash
  • Install dependencies:
    composer install
  • Open a browser on localhost:8000

CONFIGURATION FOR ADD THIS PROJECT AS A DEPENDENCY:

Installation

Install via composer running

  composer require pmmotors/pm-analytics-package

Usage

In this example, pm-reports project will be used:

Using AdWords

Injectin PmAnalyticsPackage:

// use App\Api\Analytics\AdWords\AdWordsReportV2;
use PmAnalyticsPackage\api\AdWords\AdWordsReportV2;

class AdWordsReportMaserati extends AdWordsReportV2 {

    ...

}

Using AdWordsReportMaserati

$report = new AdWordsReportMaserati(
    $clientId,
    $startDate,
    $endDate,
    $accountName
);

$report->getReport();

Using Facebook

// init al facebook configuration
Facebook::FacebookInit();

// add facebook account
$account = Facebook::FacebookAccount($account_id);

$facebookAd = new FacebookReport(
    $account,
    $startDate,
    $endDate,
    $accountName
);

$facebookAd->getDateFromFacebookAPI();

Using DialogTech

$dialog = new DialogTechReport(
    $reportStarDate,
    $reportEndDate,
    $accountName,
    $phoneNumberArr
);

$dialog->getDialogTechArray();

Using Google

$dataSourcePath = 'path';

$analytics = Google::make('analytics');
$google = new GoogleAnalyticsReport(
    $analytics,
    $profileId,
    $reportDate,
    $accountName,
    $dataSourcePath
);

$google->getAnalyticsArray();