Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7644129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:36:35+00:00 2026-05-31T09:36:35+00:00

I am new to PHP but learning slowly. Problem I have is including Google

  • 0

I am new to PHP but learning slowly. Problem I have is including Google Analytics in my header.

I have created a separate php file for the code but my issue is including this in the PHP HEADER file below:

I believe that the issue is the @$content[1] .=’ tag – but I need to include this as this is how my site is built.

How would I put the Google Analytics code before the tag without confusing the php code in the file.

Thanks in advance. (I would ask my developer but I want to learn myself).

HEADER FILE PHP CODE BELOW:

<?php

@$content[1] .='
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en" dir="ltr">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>Title</title> 
<link id="www-core-css" rel="stylesheet" href="template/css/core.css"> 
<link id="www-core-css" rel="stylesheet" href="template/css/style.css">
</script></head> 
<body>
<div id="page" class=""> </div>
<div id="masthead-container"> 
    <div id="masthead" class="">
        <a href="index.php"> 
            <button id="logo" class="master-sprite" title="Online ePub Builder"></button> 
        </a> 

        <div align="right"> 
            <script type="text/javascript"><!--
google_ad_client = "ca-pub-6078741672481332";
/* UK 1 */
google_ad_slot = "5428463210";
google_ad_width = 728;
google_ad_height = 90;
//-->
 </script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
        </div>';

    if(is_login()) {
$content[1] .='<div id="masthead-utility"> 
            Hello, <a href="user.php">'.$_SESSION['uidrealname'].'</a> 
            &nbsp; &nbsp; &nbsp; &nbsp;
            <a href="logout.php">Sign Out</a> 
        </div>';
    } else {
$content[1] .='<div id="masthead-utility"> 
            <a href="login.php">Create Account</a>
            &nbsp; &nbsp; or &nbsp; &nbsp; 
            <a href="login.php">Sign In</a> 
        </div>';
    }


$content[1] .=' <div id="masthead-nav-user"> 
            <a href="help.php">Help</a>
                <a href="guide.php">FREE Guide</a> 
        </div> 
        <div id="masthead-nav-main"> 
            <a href="new.php">New Book</a> 
            '.(is_login() ? '<a href="books.php?    u='.$_SESSION['uid'].'">My Books</a>' : '').' 
        </div> 
        <div id="masthead-end"></div> 
    </div> 
</div> 
<div id="baseDiv"> 
<div id="homepage-main-content" class="">';
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:36:36+00:00Added an answer on May 31, 2026 at 9:36 am

    Get the file content:

    $trackingCode = file_get_contents('yourFile');
    

    Then just add this into your string just before the end of your head like so:

    <link id="www-core-css" rel="stylesheet" href="template/css/style.css">
    </script>
    '.$trackingCode.'
    </head> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am pretty new to php, but I am learning! I have a simple
I'm pretty new to php but i'm learning pretty fast, I have a question
Hi I am quite new to php but i have been following some tutorials
I am learning to work with PHP and have a simple problem. <?php ini_set('display_errors',
I am new to PHP (still) and keep learning. I often have to retrieve
So I am still somewhat new to PHP, MySQL, and Javascript but I have
I am interested in learning autoloading, but new to PHP. I am reading the
Hey I am very new to Web Programming. I have been learning PHP from
I am relatively new to PHP, but experienced Java programmer in complex enterprise environments
I'm new to PHP so maybe I am overlooking something here but the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.