0

We have a website which have an iframe which is provided by a company we work with, which allows them to buy our products online.

However, the company is very reluctant to add any analytics to specific company iframes (as they all use the same code, apart from one line which changes) and they won't allow us access to the code for security reasons.

However, we are seeing a lot of people who visit the parent site (which we own) but not many, if any, products purchased - or even taken to the checkout (which we can see).

I know with Javascript we cannot see the iframe URL due to Cross Domain policy, however I was wondering if there was a way to do this with PHP.

If it makes any difference the iframe's URL is a subdomain of the parent site.

Oxi
  • 2,918
  • 17
  • 28
Jordan
  • 61
  • 1
  • 14
  • There may be a chance that you can use PHP with cUrl to make the external content looks like coming from your own domain, and you may modify the content before returning from PHP. But that really depends on what you finally want to do, since this method only affects one level but not referenced resources (e.g. JavaScript files) – slbteam08 Feb 01 '16 at 13:51

1 Answers1

0

The simplest way to know, where user came from, with php it var $_SERVER - (Server and execution environment information)

$_SERVER['HTTP_REFERER'] The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

AlexS
  • 96
  • 1
  • 3