> ## Documentation Index
> Fetch the complete documentation index at: https://magicads.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Analytics Integration

> Enhance your Magic Ads platform with Google Analytics to track user behavior and gain valuable insights. This guide walks you through setting up Google Analytics for your Magic Ads website.

## Introduction

Magic Ads's Google Analytics integration allows you to track and analyze user behavior on your platform. By adding Google Analytics, you can gain valuable insights into how users interact with your Magic Ads website, helping you make data-driven decisions to improve user experience and engagement.

<Info>Magic Ads supports GA for frontend and separate one for the Admin Dashboard, both have different setup mechanisms, below are configuration steps for both</Info>

## Frontend - Google Analytics Configuration

Follow these steps to connect Google Analytics with your Magic Ads platform's frontend page:

<Steps>
  <Step title="Step 1">
    If you don’t have a Google Analytics account, [sign up here](https://analytics.google.com/).
  </Step>

  <Step title="Step 2">
    Once logged in, click on the **Admin** button on the bottom right corner.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-1.png?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=b7db5a052e6f785c27133438bb91f7cf" width="179" height="51" data-path="images/advanced/analytics/ga-1.png" />
  </Step>

  <Step title="Step 3">
    Create a new **Property** for your Magic Ads website

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-2.png?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=e9134d5aa07daf66e3a1de3fcf53ce8b" width="345" height="374" data-path="images/advanced/analytics/ga-2.png" />
  </Step>

  <Step title="Step 4">
    Fill in the property details and rest of the information as needed.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-3.png?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=667b557c51461a0fd54707351eb16eb1" width="1555" height="693" data-path="images/advanced/analytics/ga-3.png" />
  </Step>

  <Step title="Step 5">
    Go to the home page and copy your **Measurement ID**.
    <Tip>If you’re new to Google Analytics, consider watching their introductory videos or reading their setup guide for beginners.</Tip>

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-4.png?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=70cc1a5a9310024dbe5b3a7123186146" width="477" height="274" data-path="images/advanced/analytics/ga-4.png" />
  </Step>

  <Step title="Step 6">
    Login to the Magic Ads as Admin. Go to the **Admin Panel** -> **Backend Settings** -> **Global Settings** and scroll to **Google Analytics** section. <br />
    Inlude your **Google Analytics Tracking ID** that you copied in the previous step, turn on the **Enable Google Analytics** checkbox and click on **Save** button.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-5.png?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=accbdeccb22a37ec57086d2feadda7bd" width="1030" height="319" data-path="images/advanced/analytics/ga-5.png" />
  </Step>

  <Step title="Step 7">
    You now have completed the Google Analytics configuration for frontend.
  </Step>
</Steps>

## Admin Dashboard - Google Analytics 4 Configuration

Magic Ads has integrated Google Analytics metrics view in the Admin Dashboard page, so you could directly see all your metrics from your Google Analytics account in your Admin Panel.

<Steps>
  <Step title="Step 1">
    Login into your [Google Cloud Console](https://console.cloud.google.com/) account.
  </Step>

  <Step title="Step 2">
    Once logged in, select your **project** that you want to use.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-41.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=54a1e87f51b6f3619fcae1ec9080219b" width="1873" height="968" data-path="images/advanced/analytics/ga-41.jpg" />
  </Step>

  <Step title="Step 3">
    Search for **google analytics data api** and select it among the search results as shown below.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-42.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=4023c04ee5dc3ebe9e42439e253195c1" width="1889" height="967" data-path="images/advanced/analytics/ga-42.jpg" />
  </Step>

  <Step title="Step 4">
    After selecting it make sure to **Enable** it.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-43.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=0a0d6a24660586cc5cf92fa08657c9ca" width="1877" height="960" data-path="images/advanced/analytics/ga-43.jpg" />
  </Step>

  <Step title="Step 5">
    Next, select **Credentials** tab from side menu.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-44.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=45cf55a6296d8721eb082832ac21aa09" width="1878" height="954" data-path="images/advanced/analytics/ga-44.jpg" />
  </Step>

  <Step title="Step 6">
    While you are on the Credentials page, select **Manage Service Accounts**.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-45.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=949bee2e739bd6d2416b5c93478eda3b" width="1879" height="964" data-path="images/advanced/analytics/ga-45.jpg" />
  </Step>

  <Step title="Step 7">
    Next click on **Create Service Account**.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-46.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=22fc8fa28732b17d7868f78889af1fcd" width="1880" height="969" data-path="images/advanced/analytics/ga-46.jpg" />
  </Step>

  <Step title="Step 8">
    Provide require information as you prefer and click **Done**.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-47.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=51086f04ad801d441718b041ceddf942" width="1880" height="969" data-path="images/advanced/analytics/ga-47.jpg" />
  </Step>

  <Step title="Step 9">
    Next select your newly created service account and under Actions column, select **Manage Keys**.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-48.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=a1611a5f8a384b9223ebf87e5d0ee5a0" width="1875" height="955" data-path="images/advanced/analytics/ga-48.jpg" />
  </Step>

  <Step title="Step 10">
    Next select **Create New Key**.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-49.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=a09b77f048ca6fa45dc779d2274e470d" width="1878" height="960" data-path="images/advanced/analytics/ga-49.jpg" />
  </Step>

  <Step title="Step 11">
    Next select Select key type to be **JSON** and save the file somewhere, you will need it soon..

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-49.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=a09b77f048ca6fa45dc779d2274e470d" width="1878" height="960" data-path="images/advanced/analytics/ga-49.jpg" />
  </Step>

  <Step title="Step 12">
    Now let's setup your Google Analytics account. Loging to your Google Analytics account (by default it is not GA4 only) and select your target account and click on **Admin** button at the bottom

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-50.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=08ca7f08dae7fbf3f97b03f038b973d7" width="1882" height="968" data-path="images/advanced/analytics/ga-50.jpg" />
  </Step>

  <Step title="Step 13">
    Next select **Account Access Management**.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-51.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=c9550c2e660cdaf92970eb2579ed3893" width="1883" height="964" data-path="images/advanced/analytics/ga-51.jpg" />
  </Step>

  <Step title="Step 14">
    Next click on the **Add Users** button.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-52.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=6a52470d82e1aa26d7e0c4ab7314cc50" width="1889" height="964" data-path="images/advanced/analytics/ga-52.jpg" />
  </Step>

  <Step title="Step 15">
    Enter the email same as the **client\_email** from the json file that you generated at step 11.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-53.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=a3764e53ccb9cedfb68827a0ea4ee31e" width="1879" height="966" data-path="images/advanced/analytics/ga-53.jpg" />
  </Step>

  <Step title="Step 16">
    Next select **Property** Settings.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-54.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=f91e8a3b19310ec2de5ece844929b875" width="1879" height="965" data-path="images/advanced/analytics/ga-54.jpg" />
  </Step>

  <Step title="Step 17">
    Save the **Property ID** value.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-55.jpg?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=f62f25bf632d17c0d820c721f7a3222a" width="1877" height="965" data-path="images/advanced/analytics/ga-55.jpg" />
  </Step>

  <Step title="Step 18">
    Login to the Magic Ads as Admin. Go to the **Admin Panel** -> **Backend Settings** -> **Global Settings** and scroll to **Google Analytics** section. <br />
    Enter your \***Google Analytics Property ID** and **Google Service Account Credentials JSON** File Name and click save.

    <img src="https://mintcdn.com/magicads/sOSxKmkB3A1LT8Q_/images/advanced/analytics/ga-56.png?fit=max&auto=format&n=sOSxKmkB3A1LT8Q_&q=85&s=c94d53aa4fd7a0f5ead19d2f320af999" width="1458" height="333" data-path="images/advanced/analytics/ga-56.png" />
  </Step>

  <Step title="Step 19">
    Last important step would be to upload your json file to your hosting and store it under **storage/app/analytics/**
  </Step>

  <Step title="Step 20">
    You now have completed the Google Analytics 4 configuration for admin dashboard.
  </Step>
</Steps>
