PHP - Google Tracking On Php Code?
Hey guys im a little stumped.
My pages has the following links. <a href="?page=yes">Yes</a> to Change content i use <?php if (isset($_GET['page'])) { include ("include/".$_GET['page'].".php"); } else { echo 'Welcome to Liquids Scripts PHP Code repository. Just select the categorie from the top and get all the info required '; } ?> Will this be tracked by google analytics? Any help would be awsome. Similar TutorialsHey guys, I am not a coder at all and would love a little bit of help with my code not working. Basically, I have a redirect script that sends my visitors to a software download. I want to be able to track a snippet from the incoming refer and send it along with the download. I hope I am explaining this correctly. Here is my code: <?php $tid = $_GET["tid"]; header( 'Location: http://www.liutilities.com/affcb/?id=RBgendtd&aff=14231&xat=WU-<?php echo $tid; ?>' ); ?> The page that sends them to this script automatically adds ?tid={keyword here}. What the above script is supposed to do is grab tid and then put it after the &xat=WU- but instead, its only putting the actual code itself (&xat=WU-<?php echo $tid; ?>). Can anyone offer a suggestion? Thanks so much! I got this code made for me to put on my google search code. <?php $click_value = '0.001'; //Amount in dollars that each click is worth function increment_clicks() { //Get current click count if(file_exists('click_count.txt')) $clicks = file_get_contents('click_count.txt'); else $clicks = 0; //Add current click to count $clicks++; //Save new value to file $file = fopen('click_count.txt', 'w'); fwrite($file, $clicks); fclose($file); } function get_click_amount() { global $click_value; //Get current click count if(file_exists('click_count.txt')) $clicks = file_get_contents('click_count.txt'); else $clicks = 0; //Return value of all clicks based on $click_value, formatted to 2 decimal places return number_format($clicks * $click_value, 3); } if (isset($_POST['search'])) { //Search button was clicked, increment count increment_clicks(); } $click_amount = get_click_amount(); ?> <html> <head> </head> <body> <center> <p id="click_amount">$<?php echo $click_amount; ?></p> <form action="" method="POST"> <input type="text" name="search" value="" /> <input type="submit" value="Search" /> </form> </center> </body> </html> Now i do not know how to put it in my google code if you put it on a page by itself it works. I do not know if i can list my google code here so if anyone can help i will pm them m google code. THANKS Hi guys, this is the geocoding part of the code. I ran this ion my localhost and it runs ok. Then when i uploaded it to my server i got 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. When i take out the php the html code run ok... so its not that. Can anyone help? I have taken out my key and db connection. Im hosted on black knight if thats any help Code: [Select] <?php require("config.php"); define("MAPS_HOST", "maps.google.com"); define("KEY", "****"); // Opens a connection to a MySQL server $connection = mysql_connect("localhost", "root", "password"); if (!$connection) { die("Not connected : " . mysql_error()); } // Set the active MySQL database $db_selected = mysql_select_db("database", $connection); if (!$db_selected) { die("Can\'t use db : " . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM users WHERE 1"; $result = mysql_query($query); if (!$result) { die("Invalid query: " . mysql_error()); } // Initialize delay in geocode speed $delay = 0; $base_url = "http://" . MAPS_HOST . "/maps/geo?output=xml" . "&key=" . KEY; // Iterate through the rows, geocoding each address while ($row = @mysql_fetch_assoc($result)) { $geocode_pending = true; while ($geocode_pending) { $address = $row["address1"]; $id = $row["id"]; $request_url = $base_url . "&q=" . urlencode($address); $xml = simplexml_load_file($request_url) or die("url not loading"); $status = $xml->Response->Status->code; if (strcmp($status, "200") == 0) { // Successful geocode $geocode_pending = false; $coordinates = $xml->Response->Placemark->Point->coordinates; $coordinatesSplit = explode(",", $coordinates); // Format: Longitude, Latitude, Al itude $lat = $coordinatesSplit[1]; $lng = $coordinatesSplit[0]; $query = sprintf("UPDATE users " . " SET lat = '%s', lng = '%s' " . " WHERE id = '%s' LIMIT 1;", mysql_real_escape_string($lat), mysql_real_escape_string($lng), mysql_real_escape_string($id)); $update_result = mysql_query($query); if (!$update_result) { die("Invalid query: " . mysql_error()); } } else if (strcmp($status, "620") == 0) { // sent geocodes too fast $delay += 100000; } else { // failure to geocode $geocode_pending = false; echo "Address " . $address . " failed to geocoded. "; echo "Received status " . $status . " \n"; } usleep($delay); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Your Profile Page</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="css/1.css" type="text/css" media="screen,projection" /> </head> <body> <div id="wrapper" class="fixed"> <div id="header"> <h1>Find A Tag Team</strong></h1> <ul id="nav"> <li><a href="home.html">Home</a></li> <li><a href="index.html"></a>Logout</li> <li><a href="Links.php">Links</a></li> <li><a href="Videos.php">Videos</a></li> </ul> </div> <div id="sidebar_left"> <h2>Your Profile Page</h2> <p> </p> <p> From here you can ...<br /> -Edit all your information <br /> -Search for other users <br /> -View any emails you may have recieved</br /> </p> <p> </p> </div> <div id="content"> <h1>Profile</h1> <div class ="message"> The map has been succesfully updated. <br /> <a href = "map.php">View the Map</div> <div id="footer"> </div> </div> </body> </html> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=356789.0 I have a Google Adsense code that I am saving to the wp_options table. I can successfully save and retrieve the variable containing the google adsense code but it doesn't do anything except display it as plain text on screen. Hi, here's my problem let's say I gave an end user a url such as e.g http://www.test.com/index.php?user=asdf1234 and I did the same thing to different end users with unique $_GET['user'] value each . my question is, how to track the URLs ?, i mean, how will i know if those urls were clicked and how to count the clicks made ? some possible scenarios could be - the url is pasted and send via email - the url is embeded as a link in some portals Hey guys! I had a quick question that is more about php coding theory than actual code. Anyway, I was curious as to how one would track ad clicks and impressions (especially the impressions). There are tons of sites that do this but I don't really understand how. Thanks I've been reading about trackbacks and pings but what I'm trying to do is a bit different. I'm trying to track a referral link. For example, I post this referral link http://www.my-site.com/3ji89 on youtube or a blog.. and that referral links to.. http://www.another-site.com in http://www.another-site.com is it possible to retrieve the referral link http://www.my-site.com/3ji89 ? Not youtube.com or the blog I posted the link on. hi i need a script to track how many times a link has been clicked, if this is possible can i have some guidance cheers matt Hello.. Anyone knows a little bit about pixel tracking?? I need to implement it in my email.... Hi, how can I track my order with DHL API? I want to implement SOAP request in PHP. Can you help me? Edited June 11 by requinixsplit from https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/ I am looking to save the user's access of an application. For instance, when they log in, I create a record in the "track_login" table which includes information such as the requesting IP, the user's ID, the date, (not the user's password), etc. And then for every page they visit, I store a record in the "track_page_viewed" table which includes a FK to the "track_login" table and also includes additional information about their request.
Both the track_login and track_page_viewed tables are currently in the same database as used by the primary application.
So far, so good.
Next, I want to start tracking when a user does special tasks such as when they forget their password and request that a new one be emailed to them. Or maybe when they attempt to login with an invalid username and password. Currently, I just included another table called "track_special" which includes the data, the type of special request, etc.
Now, I am thinking of adding three other things to track:
General PHP errors
MySQL errors
Try/Catch errors which I did not expect to happen
One option is just to add these to my "track_special" table or maybe make one or three new tables in the same database.
But is this a good idea? If I have a SQL error, do I really want to store the error in the same database? Maybe I should use a separate database called "myTrackerDB", and include all the above tables in that database? Or maybe I should just write the data to a flat file, and parse the file on a regular basis, and then store the information in the database?
Please provide any recommendations, guidance, suggestions, criticism, etc. Thank you
I have a small database snippet over at SQLFiddle: http://sqlfiddle.com/#!2/9ff722/55
I need help with writing a query that will allow me to track students in a certain cohort from beginning to graduation. I have two tables: application and stu_acad_cred. The application has the start term and the stu_acad_cred are course registrations. If I want to track students in a fall 2012 (12/FA) cohort, then the query must join the two tables; if the student has a start term of 12/FA *and* has registered for 12/FA courses, the student should be counted. I then want to track those student from year to year or term to term to see if the number of students that started in the 12/FA cohort actually decrease overtime. So, the results should return something similar to below.
| # Students (12/FA Cohort) | Year | ------------------------------------- | 2 | 2012 | | 2 | 2013 | | 2 | 2014 |I am not sure if this can be done straight forward or with a stored procedure but any help or direction is greatly appreciated. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=350102.0 Hello everyone. I have a small problem. I might receive a ?aff=## or not on the end of my url when I get a visitor to my website. This depends on if they are sent from a affiliate website or not. If they are it shows fine on the home page but I loss it if they go to another page on my website. I need to keep this ?aff=## information while they look at the other pages. How would I capture and pass this information to my other pages as they surf my site? I tried this to no avail. $aff=$_GET['aff']; I have no clue no adding it back to the next page they go to. Any ideas would be helpful.. Hi everyone, I'm developing an affiliate tracking process and after a lot of thought, I was wondering if someone might be able suggest if I'm on the right track. I'm trying to get away from the usual ...?id=135845 type of links. I was thinking about two possibilities: 1. (I don't know if this is possible), but to generate a subdomain with php at the time an affiliate signs up and then track them by extracting the subdomain to identify the affiliate, or 2. Somehow, maybe using a mod rewrite, using the affiliate username at the end of a url, ex. www.website.com/username , you can see that there is no extension, but when a person comes to that url, it will display the contents of www.website.com and I'd extract the username 'username' from the url and query the database to identify the affiliate. Any thoughts on how this can be done? Hi, I'm trying to make/ am looking for a script (that's free) to provide users with a button to donate, once they have donated they are then returned to the website and the donation amount is stored in a database. I have no idea how i would get this made and the paypal website wasn't much help either. If anyone knows of a free script or can help me make one i would be very greatful. As we have been working on an eCommerce project, we want to add an option in the eCommerce, that user should have the live location tracking of delivery boy (as same as SWIGGY) in the website. Is there any chance to track the live location using PHP and JavaScript? Searched on the google but nothing resolved my problem? Please anyone suggest us to track the live location of the delivery boy. Thanks in advance This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=311981.0 |