@extends('layouts.app') @section('title', 'Ad platforms – Setting') @section('content') @php $metaConnected = $meta->isConnected(); $metaReady = $meta->hasAppCredentials(); $metaOk = $metaConnected && $meta->last_verify_ok; $adAccounts = $meta->adAccounts(); @endphp

← Setting

Ad platforms

Connect advertising accounts here. Start with Meta Ads (Facebook & Instagram campaigns). Google Ads and other platforms will use the same page.

@if(session('success') || session('verify_ok'))
{{ session('success') ?: session('verify_ok') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif

Meta Ads

Facebook & Instagram campaigns, budget, and insights.

@if($metaOk) Connected @elseif($metaConnected) Needs verification @elseif($metaReady) Ready to connect @else Not set up @endif
@if($metaConnected)
Signed in as {{ $meta->connected_as_name ?: 'Meta account' }}
@if($meta->ad_account_name || $meta->ad_account_id)
Ad account {{ $meta->ad_account_name ?: 'Selected account' }} @if($meta->ad_account_id) {{ $meta->ad_account_id }} @endif
@endif @if($meta->connected_at)
Connected {{ $meta->connected_at->timezone(config('app.timezone'))->format('M j, Y g:i A') }}
@endif @if($meta->last_verified_at)
Last check {{ $meta->last_verify_ok ? '✓' : '✗' }} {{ $meta->last_verify_message }} ({{ $meta->last_verified_at->diffForHumans() }})
@endif @if($meta->maskedAccessToken())
Token {{ $meta->maskedAccessToken() }} @if($meta->token_expires_at) · expires {{ $meta->token_expires_at->diffForHumans() }} @else · does not expire @endif
@endif
@endif
@csrf

App credentials

From Meta for Developers → Avi Jewels Ads. Stored here, not in chat. Leave App Secret blank to keep the current one.

Copy this into Meta → Facebook Login for Business → Settings → Valid OAuth Redirect URIs, then Save changes. App domains must be only tools.avijewels.info (no https). {{ $callbackUrl }}
@csrf
@if($metaConnected)
@csrf
@csrf
Open Ad Manager @endif
@if(! $metaReady)

Save App ID, App Secret, and Configuration ID before Connect with Facebook is enabled.

@endif @if($metaConnected && count($adAccounts) > 1) @endif

Daily performance report

Short email of every active Meta campaign. Read-only.

@if($meta->dailyReportEnabled()) Scheduled @else Off @endif

Compares the last 3 complete days vs the 3 before, and the last 14 complete days vs the 14 before. Today is excluded. Tools will not pause campaigns or change budgets. One email per day at 10:00 AM America/New_York (Miami). Off by default until you turn it on.

@csrf
@csrf

Send test works even while the daily report is off. It uses the saved address. @if(! $metaConnected) Connect Meta Ads first or the test will fail. @endif

AVI Customers – Auto Sync

Add every Shopify, Payment Link, and Layaway/Story contact with a real email or phone to customer list {{ $customerListAudienceId }} on act_673640625594279. Merges duplicates. Never Replace or Remove. Does not touch the pixel or Story website audiences.

@if($customerListRun)
Last sync {{ $customerListRun->finished_at?->timezone(config('app.timezone'))->format('M j, Y g:i A') ?: '—' }}
Read / sent / skipped / errors {{ $customerListRun->read_count }} / {{ $customerListRun->sent_count }} / {{ $customerListRun->skipped_count }} / {{ $customerListRun->error_count }}
@if($customerListRun->error_message)
Note {{ $customerListRun->error_message }}
@endif
@else

No sync yet. Use Sync now after deploy. A daily job also runs at 5:30 AM America/New_York.

@endif
@csrf
@if(! $metaConnected)

Connect Meta Ads first.

@endif

Google Merchant supplemental feed

Regenerate the CSV Google Shopping fetches. Same URL every time.

@if(!empty($merchantFeedExists)) Ready @else Not generated @endif

Use this after you add or change products when you do not want to wait for the Sunday backup run. Does not change Shopify. After it finishes, press Update in Merchant Center if you need Google to fetch right away.

Feed URL: {{ $merchantFeedUrl }}

@if(!empty($merchantFeedExists) && !empty($merchantFeedGeneratedAt)) Last generated {{ $merchantFeedGeneratedAt }} (server time). @else No file yet — generate once below. @endif Weekly backup: Sunday 3:30 a.m. America/New_York.

@csrf

Google Ads

Search and YouTube campaigns.

Coming soon

Same layout as Meta: credentials, Connect, and Verify. Not available yet.

@push('styles') @endpush @endsection