How to add new property in google analytics

To add a new property in Google Analytics, follow these steps:

Method 1: Using the Google Analytics Web Interface

  1. Sign in to your Google Analytics account.
  2. Click on the "Admin" button in the bottom left corner of the screen.
  3. Click on "Create Property" from the dropdown menu.
  4. Select "Web" as the property type (or "Mobile" or "App" if applicable).
  5. Enter the property name and URL.
  6. Choose the industry category and reporting timezone.
  7. Click "Create" to create the new property.

Method 2: Using the Google Analytics API

  1. Create a new project in the Google Cloud Console.
  2. Enable the Google Analytics API.
  3. Create a new service account and generate a private key file.
  4. Install the Google Analytics API client library for your preferred programming language.
  5. Use the client library to create a new property using the analytics.management.properties.insert method.

Here is an example of how to create a new property using the Google Analytics API in Python:

import os
import json
from google.oauth2 import service_account
from googleapiclient.discovery import build

# Replace with your own values
PROPERTY_NAME = 'My New Property'
PROPERTY_URL = 'https://example.com'

# Authenticate with the Google Analytics API
creds = service_account.Credentials.from_service_account_file(
    'path/to/private/key.json',
    scopes=['https://www.googleapis.com/auth/analytics']
)

# Create the Google Analytics API client
analytics = build('analytics', 'v3', credentials=creds)

# Create the new property
property_body = {
    'name': PROPERTY_NAME,
    'websiteUrl': PROPERTY_URL,
    'industryCategory': 'Retail',
    'timezone': 'America/New_York'
}
property = analytics.management().properties().insert(
    body=property_body
).execute()

print('Property created:', property.get('id'))

Method 3: Using the Google Analytics Tag Assistant

  1. Install the Google Analytics Tag Assistant extension in your browser.
  2. Open the extension and click on the "Create Property" button.
  3. Enter the property name and URL.
  4. Choose the industry category and reporting timezone.
  5. Click "Create" to create the new property.

Note: The Tag Assistant is only available for Chrome and Firefox browsers.

After creating a new property, you can add tracking codes to your website or app to start collecting data.