Here is a short example of URL parameters that we would use:
example.com/article-1/?utm_campaign=marge&utm_source=google
The strategy of this website, being that we encourage seekers to explore other articles, we need to track as much as possible from our ads. We would want to know if a seeker converted on another article different than the first.
Currently if a user landed here:
example.com/article-1/?utm_campaign=marge&utm_source=google
Then clicked to another article here:
example.com/article-2/ , We lose the parameters and Google Analytics could only show us that our seeker stayed on one page. What can be done so that we could pass that information in the URL along with any page?
utm_medium in mandatory, anyway you should not use UTMs for internal links because they generate anomalies in report, rather use different parameters, e.g., ?from=article
Related
I have a PHP website based on codeigniter. It uses Mode View Controller and has articles. Each article has id and is displayed by Articles controller. Once an article is displayed the url looks like http://localhost/ci/articles/show_article/245. Now the problem is any one can enter number like 246 123 222 and view the articles at random. am not comfortable with this. I want readers to go the way things are organized in the site and want to stop them from directly accessing the articles from URL.
How can this be achieved in PHP / codeigniter.??
This cannot be done. You cannot control what a user types into the web browser.
You can't control user outside the browser area, and if you could. you should not.
Alternatively, you could use encoded article Ids by your own pattern to make it unpredictable. when these encoded article ids are received, decode them back and show the articles accordingly.
It's impossible to do this, and there's also no reason that you should be uncomfortable with it. You can't prevent client-side requests. I think anyone trying to use your site properly (assuming it is set up properly) won't try to go through articles out of order.
If you absolutely must, what you can do is something like set a _SESSION flag for what articles they have visited and if they try to get to one out of order, redirect them.
I've been asked to look into building a widget for a website that looks at the content of the page its on and then displays relevant search results. My approach would be to use either the meta keywords or to do a count of words used within the document and use the highest occurring ones. Before I can do any of that though, I need to be able to get at the content of the containing page from the iframed page; is this at all possible? From what I can see it is not and I can only get the document referrer (where there might be useful information in the url I suppose).
Anyone know if this is at all possible?
As stated in my comment on the OP, due to XSS (cross site scripting) restrictions broswers will block any attempt to do anything (whether reading or writing) between sites on different domains.
So the answer is no, you will not be able to do what you've been asked by your clients.
The most you would be able to get is referal information, or (as you say) any information provided via the query string that the host site is willing to provide
This is really a point me in the right direction question. What path should I take if I want to display the number of page views each gallery page receives?
Retrieve Google Analytics Data via PHP, or
Capture the page views directly on my pages with my own PHP and mySQL setup?
Seems, like number 1 would be the better choice. I just don't know how difficult this option will be. Any insights on this?
Option 2 is definitely simpler.
If you do figure out how to get the page results out of Google Analytics, they will not be up-to-date. It takes Google at least several hours before the page views show up.
That also depends if You want to have info on more questions (statistics). I often use custom setup to track such things cause I can later use some data to do statistics about users actions.
For example, You want to give users (owners of photos) info about witch users (male or female, 30+ or below 30, and so on) are viewing. How many guests, how many registered users. There are tons of data You can retrive by building custom system.
It all depends on what You want to have at the end.
I suspect that if You want to have only raw data about number of users You coud somehow parse data from Google Analytics as well.
And as posted below. Google have to take time to update, custom setup not.
I have created a widget for my web application. User's getting code and just pasting that code in their website and my widget works on their website something like twitter, digg and other social widgets.
My widget is on the basis of post, for a single post (say postid: 234) I am providing single widget, so anyone can embed the widget on their website.
Now I want to know that where all my widget is posted and for which post? for that I have recorded the URL of the site when my widget start (onload) but the problem arises when someone placed the widget in their blog or website's common sidebar. I am recording URL each time and hence if it's in sidebar of a blog then it's recording URL for every post which is creating duplicates.
can anyone help on this? How should I go so that I have only one single record for a widget on a site?
I think doing something like this is a bit tricky. Here are some ideas that pop to mind
You could for example ask the user to input their site's URL when they get the widget, or the widget could track the domain or subdomain, thus giving less URLs.
Just tracking the domain would obviously be problematic if the actual site is domain.com/sitename/, and there could be more than one site under the domain. In that case, you could attempt to detect the highest common directory. Something like this:
You have multiple URLs like this: domain.com/site/page1, domain.com/site/page2, and so on. Here the highest common directory would be domain.com/site.
I don't think that will always work correctly or provide completely accurate results. For accuracy, I think the best is to just ask the user for the URL when they download the code for the widget.
Edit: new idea - Just generate a unique ID for each user. This could be accomplished by simply taking the current timestamp or something, and hiding it into the code snippet the user is supposed to copy. This way you can track the ID itself and any URLs and domains it appears in can be grouped under it.
If you have an ID which doesn't get a hit in say week or something you could remove it from your database, and that way avoid filling it up with unused IDs.
I agree with Jani regarding a unique id. When you dish out the script you'll then be able to always relate back to that id. You are still going to have duplicates if the user uses the same id over and over, but at least you'll have a way of differentiating one user from another. Another useful advantage is that you are now able to, as Jani said, group by the ID and get a cumulative number for all of the instances where that user used the script & id.
I'm trying to enter a list of items into Google Base via an XML feed so that, when a user searches for one of these items and then clicks the search result link in Google Base (or plain Google), the user is directed to a dynamic Web page on my Web site. I'm assuming that the only way to specify a specific link (either static or dynamic) is through the attribute in the XML feed. Is that correct? So, for example, if my attribute is:
http://www.example.com/product1-info.html
the user will be directed to the product1-info.html page.
But if, instead of a static product page, I want to have the user redirected to a dynamic page that generates search results from my local database (on my Web site) for all products containing the keyword "product1", would I be able to do something like this?:
http://www.example.com/products.php?productID=product1
Finally, and most importantly, is there any way to specify this landing page (or any specific landing page) from a "regular" Google search? Or is it only possible via Google Base and the attribute? In other words, if I put a bunch of stuff into Google Base, if any of it shows up in a regular Google search, is there a way for me to control what parameters get passed to the landing page (and thus, what search is performed on the landing page), or is that out of my control? I hope I explained this correctly. Thanks in advance for any help.
first question: Yes, urls containing a query_string part are allowed.
http://base.google.com/support/bin/answer.py?hl=en&answer=78170 says:XML example:
<link>http://www.example.com/asp/sp.asp?cat=12&id=1030</link>
--
Let me rephrase the second question to see if I understand it correctly (might be completely on the wrong track): E.g. products.php?productID=product1 performs a db-search for the product "FooEx" and products.php?productID=product2 for "BarPlus". Now you want google to show the link .../products.php?productID=product1 but not ....?productId=product2 if someone searched for "FooEx" and google decided that your site is relevant? Then it's the same "problem" we all face with search engines: communicate what each url is relevant for. I.e. e.g. have the appropriate (and only the appropriate) keywords appear in the title/h1 element of the page, avoid linking to the same contents with different urls (e.g. product.php?x=1&productId=1 <-> product.php?productId=1&x1, different urls requesting most probably the exact same contents), submit a sitemap, and so on and on....
edit:
and you can avoid the query-string part all together by using something like mod_rewrite (e.g. the front controller for the zend framework makes use of it) or by parsing the contents of $_SERVER["PATH_INFO"] (this requires the webserver to provide that information), e.g. http://localhoast/test.php/foo/bar -> $_SERVER['PATH_INFO']=='/foo/bar'
Also take a look at the link to this thread: How to redirect a Google search result to a dynamic Web page?, it contains the title of the thread, but SO is perfectly happy with How to redirect a Google search result to a dynamic Web page?, too. The title is "only" additional data for search engines and (even more) the user.
You can do the same:
http://www.example.com/products.php/product1/FooEx <-> http://www.example.com/products.php/product2/BarPlus