This project is an Ad Server built with PHP. It serves advertisements to clients and tracks various metrics for analysis. The server is designed to be efficient and scalable, handling high traffic and providing relevant ads based on user data.
- Ad Serving: Serve relevant ads to users based on predefined criteria.
- Tracking: Track impressions, clicks, and other important metrics.
- Reporting: Generate reports on ad performance.
- Scalable Architecture: Designed to handle high traffic efficiently.
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Apache/Nginx web server
-
Clone the repository:
git clone https://github.com/gursimran2407/AD-SERVER-PHP.git cd AD-SERVER-PHP
-
Set up the database:
- Import the provided SQL schema into your MySQL database.
mysql -u username -p database_name < database/schema.sql
-
Configure the application:
- Rename
config.sample.php
toconfig.php
. - Update the database configuration in
config.php
with your database credentials.
- Rename
-
Install dependencies:
- If using Composer for dependency management, run:
composer install
-
Run the server:
- Ensure your web server is configured to serve the project directory.
-
Access the dashboard:
- Navigate to
http://your-server-url/dashboard
to access the admin dashboard. - Use the default admin credentials to log in:
- Username:
admin
- Password:
password
- Username:
- Navigate to
-
Manage ads:
- Use the dashboard to create, edit, and delete ads.
- Assign ads to different campaigns and track their performance.
-
Serve ads:
- Integrate the ad-serving script into your client applications.
- Use the provided API endpoints to fetch and display ads.
-
Get Ad:
- URL:
/api/getAd
- Method:
GET
- Parameters:
userId
(optional): The ID of the user requesting the ad.
- Response:
{ "adId": 123, "content": "<ad-content>" }
- URL:
-
Track Click:
- URL:
/api/trackClick
- Method:
POST
- Parameters:
adId
: The ID of the clicked ad.
- Response:
{ "status": "success" }
- URL:
-
Track Impression:
- URL:
/api/trackImpression
- Method:
POST
- Parameters:
adId
: The ID of the displayed ad.
- Response:
{ "status": "success" }
- URL:
-
Ads:
id
: INT, primary keytitle
: VARCHAR(255)content
: TEXTcampaign_id
: INT, foreign keycreated_at
: TIMESTAMPupdated_at
: TIMESTAMP
-
Campaigns:
id
: INT, primary keyname
: VARCHAR(255)budget
: DECIMALstart_date
: DATEend_date
: DATEcreated_at
: TIMESTAMPupdated_at
: TIMESTAMP
-
Metrics:
id
: INT, primary keyad_id
: INT, foreign keyimpressions
: INTclicks
: INTcreated_at
: TIMESTAMPupdated_at
: TIMESTAMP
-
Fork the repository: Click the 'Fork' button on the top right corner of this page.
-
Create a new branch:
git checkout -b feature-branch
-
Make your changes:
- Ensure your code follows the project's coding standards.
- Include appropriate tests.
-
Commit your changes:
git commit -m "Description of your changes"
-
Push to your branch:
git push origin feature-branch
-
Create a Pull Request: Submit your pull request from your fork's branch to the main repository's
master
branch.
This project is licensed under the MIT License. See the LICENSE file for more details.