chris
chris

Reputation: 649

How to test QUERY_PARAM?

I'm trying to implement QUERY_PARAM to forward a query string parameter internally like this:

<a href="https://example.com/ref/?v=QUERY_PARAM(version,0)" data-amp-replace="QUERY_PARAM">test</a>

However, I can't get it to work on my local server and I'm not sure how to test it. Is the substitution happening on Google's AMP cache side? Or should it work locally too (not sure how?). Or is it only for Google Analytics? I can't understand it by reading the documentation and the few other resources.

Upvotes: 1

Views: 594

Answers (1)

Sebastian Benz
Sebastian Benz

Reputation: 4288

The substitution works on your local server. The parameter replacement takes place at runtime though. You actually have to click on a link to see it in action.

One other thing: if you're linking to a different domain you need to explicitly whitelist the domain in the header via:

<meta name="amp-link-variable-allowed-origin" content="https://example.com https://example.org">

Upvotes: 2

Related Questions