Google Code for Lead Conversion Page - php

I want to put Google Analytics code after people signup AJAX contact form.
If I put this in PHP file that gets submitted by AJAX post request. Do you think this will trigger this javascript codes when it runs?

In theory, you could create a results page that contains your Analytics code. On getting back results from Ajax dynamically create an iFrame that loads your results page. Set the iFrame's display attribute to none (e.g. style="display:none;").
This should have the results page show up in your Analytics stats without visitors to the site seeing it.
Edited to add: Google's official approach is documented here: https://support.google.com/analytics/bin/answer.py?hl=en&answer=1033068
It's less of a hack than the above :-)

Related

Get the complete html code from an album of facebook

I'm trying to get the html code from an album of facebook,once done that i want to extract the photo links,
but as we know all the photos are not loaded at once but as you scroll down.
When i use cURL it get only those links of the photos which are loaded at first.
Will there be a way to get the whole loaded html code through php?
Please bear with my english.
Thanks
EDIT: Well i was wanting to do the same on any page which have this kind of behavior not only on facebook. Thanks anyway
You will not be able to reliably fetch an album from Facebook via this method.
There are a small amount of photos sent with the original request and the rest are loaded via ajax. Using curl, there is no way that I am aware of to simulate the events that lead to said ajax load. You could call the original, and then subsequently call the other ajax endpoints but this method is likely to break the second fb changes anything.
As ceejayoz said, you should be using the fb api for this sort of thing.

Ajax pages - google SEO

I build website with all pages in ajax.
The problem is the ajax pages havn't header and footer like index page.
So I want google will index the ajax pages after they inserted to index.
In other words, I want google to index my ajax pages with header and footer.
How can I do that?
Thanks!
You can follow googles instructions on this page: https://developers.google.com/webmasters/ajax-crawling/
This solutions work by making an image of you website specific for Googles searchengine.
Alternatively you could make a mirrorsite available for browsers without JavaScript enabled, which Google easily will index.
Have regular, complete webpages (you can generate them on the server) at the URLs you want the browser to display and link to them as normal
Provide an web api that JavaScript can get the content for a page from
Have your JavaScript:
Bind event handlers to the links
Map the URL in the href attribute of the clicked link onto the web api
Use Ajax to fetch the data from the web api (as mentioned in step 2)
Update the page with that data
Change the URL to the actual page (as mentioned in step 1) using pushState

Working of browser 'back button' using jquery ajax and PHP

I am working on an application which involves lot of ajax requests for updating the HTML content.I have a dashboard with a fix left menu or accordian panel which takes the event and based on the events I have to update the center portion of the page using ajax.
Issue: I am facing issue with the back button of the browser as I am not refreshing the page.I want that the user should be able to navigate back and forth through the ajax content,but as I don't change the URL it redirects the user to the previous page they came from and destroys all the information entered by the user in the fields.
While making a search I came through this website which is quite popular and manages a playlist on the left and a player at the bottom without refreshing the page,but the URL changes for different content the show.
I am not sure if there is any specific framework that can be used or it can be achieved via normal code.Any help in pointing me to the right links or suggestions over it would be helpful.
Thank you
What you seem to want is history.js. It uses the HTML5 history API to navigate (and you can fire events upon change), and it also supports older browsers by using hashbangs.
Essentially the browser will not load any new page, but you can still change the URL to reflect changes (and have the users bookmark pages etc.).
Take a look at their demos to see if it's what you're looking for.

How do you do dynamic refresh of a single div tab using php/ajax and have the content actually change the local html on the page

How do you do dynamic refresh of a single div tab using php/ajax and have the content actually change the local html on the page (so that it is changed when you go to ‘view source’ in a browser) instead of just putting the change in a JavaScript object? I am trying to design a webpage that loads search results without refreshing the entire page. I use a simple hash followed by a GET/query string request to determine what content to load. This gets passed to a JavaScript XMLHttpRequest, then to some php which picks up the GET and passes it to a SOAP service and finally echo’s the SOAP results back to the XMLHttpRequest to get displayed in a document.getElementById div change. This works fine for usual display in conventional browsers. However I am concerned that search bots and screen readers are not going to recognize the majority of the content that shows in browsers because it is all contained within a client side JavaScript object.
So, I guess my first question is: is this a valid concern? If it is, is there a work around?
Thanks!
AJAX content is very hard to get indexed. Google has webmaster guidelines for AJAX. This should get you started in the right direction on getting your content indexed.
I'm inexperienced with search engine behavior but as far as i know the best option is to load the full content of your div on a php page, when the page load you can include that page inside the div, and then start using js/jquery to refresh that every so many seconds.
this way when a search bot gets on the site it will see the current content, and users will see it update.
updating the div box can be done quite easy using ajax function and jquery.

Using YQL in javascript/php to scrape article html?

I'm new to YQL, and just trying to learn how to do some fairly simple tasks.
Let's say I have a list of URLs and I want to get their HTML source as a string in javascript (so I can later insert it to a database via ajax). How would I go about getting this info back in Javascript? Or would I have to do it in PHP? I'm fine with either, really - whatever can work.
Here's the example queries I'd run on their console:
select * from html where url="http://en.wikipedia.org/wiki/Baroque_music"
And the goal is to essentially save the HTML or maybe just the text or something, as a string.
How would I go about doing this? I somewhat understand how the querying works, but not really how to integrate with javascript and/or php (say I have a list of URLs and I want to loop through them, getting the html at each one and saving it somewhere).
Thanks.
You can't read other pages with Javascript due to a built-in security feature in web browsers. It is called the Same origin policy.
The usual method is to scrape the content of these sites from the server using PHP.
There is an other option with javascript called a bookmarklet.
You can add the bookmarklet in your bookmarks bar, and each time you want the content of a site click the bookmark.
A script will be loaded in the host page, it can read the content and post it back to your server.
Oddly enough, the same origin policy, does not prevent you to POST data from this host page to your domain. You need to POST a FORM to an IFRAME that has a source hosted on your domain.
You won't be able to read the response you get back from the POST.
But you can poll with a setInterval making a JSONP call to your domain to know if the POST was successful.

Categories