How to tell page cache to ignore certain URL parameters - intershop

we are having a problem with webadapter page caches being filled up with different entries generated by URLs which contain gclid parameter which is unique for each URL.
The example of such URL is
https://www.a1.hr/INTERSHOP/web/WFS/A1-Shop-Site/hr_HR/-/HRK/ViewStandardCatalog-Browse?campaignID=ljeto&gclid=EAIaIQobChMIiu7U2PGU8gIV2IeyCh311wBOEAEYASAAEgKQW_D_BwE&CatalogID=MobilePhones&CategoryName=MobilePhones
How can we tell page cache to ignore gclid parameter and to cache result for URL without glcid, so that cache key is for example:
https://www.a1.hr/INTERSHOP/web/WFS/A1-Shop-Site/hr_HR/-/HRK/ViewStandardCatalog-Browse?campaignID=ljeto&CatalogID=MobilePhones&CategoryName=MobilePhones

In the share/system/config/cluster/webadapter.properies file you'll find some example code:
## Defines a list of query attributes which are to be ignored
## in the page cache lookup. Mainly intended to ignore unwanted
## x/y coordinates, which are included with image button clicks.
# pagecache.ignore.0=submit.x
# pagecache.ignore.1=submit.y
Using pagecache.ignore.n should do the trick.
The knowledge base article is here: https://support.intershop.com/kb/index.php/Display/27984R

Related

Change Wordpress REST response

I have a plugin that puts custom post types onto a map. It uses Leaflet and specifies a REST API link as the source of its data. A map is displayed with a number of location markers and when clicked a details box pops up with the name of what's at that location and there's a hyperlink in this details box which when clicked takes the user to another page on the site. Here's what is specified as the data-endpoint source:
http://rd-dev.local/wp-json/citadela-directory/map-data/points/citadela-item?dataType=markers&category=&location=&only_featured=0
This call returns JSON that looks like this:
{"total":40,"points":[{"track":[],"coordinates":{"longitude":14.726660728455,"latitude":46.813816070557003},"title":"Name of place","permalink":"http:\/\/rd-dev.local\/item\/something\/","address":"Address, line 2, Someplace, Some Country","image":"http:\/\/rd-dev.local\/wp-content\/uploads\/2020\/12\/0b-1-150x150.jpeg","postType":"citadela-item","faIcon":"fas fa-circle","color":"#0085ba"}, ... etc
Part of each record in the response is a link to a url on the site, which the user clicks to see the detail:
http:\/\/rd-dev.local\/item\/something
I want to change the page that users see when they click a location so it occurred to me that one way, and which at my level of knowledge is probably the simplest, is to alter the JSON response that Wordpress gives. Specifically, i want to change all occurrences of "item" to a something different.
Is there a way to change the JSON stream as it is sent out by the REST API?
I solved this. I searched for register_rest_route occurrences in the source files and was able to find one for this particular route. The register_rest_route call includes a callback function where the response is constructed. It was then a case of putting that response through text replacement calls.

How to set-up trigger only to Homepage - google tag manager

how I can set-up trigger to fire only on Homepage? We´re using also UTM parameters so condition URL Path equals http://website.com is not working.
Thank you!
Create a JavaScript variable in Google Tag Manager to return the value of document.location.pathname
This variable will contain the value of the current URL path, without any URL parameters or fragments.
You can then set your homepage trigger to fire when the value of your JavaScript variable equals /
Pattern for a homepage usually would be ^/$. In human language it means “starts and immediately ends with /”.
As URL variable contains domain name and possible query parameters (that is what goes after ?), better to use Page Path (Make sure you have it enabled in your GTM Account, under Variables > Enabled Built-In Variables).
http://www.apasters.com/blog/regex-guide-google-analytics-tag-manager/

How to exclude imported URL parameters when they have no value?

I've installed the Swagger Importer, which is just great. It saved a lot of setup time. It also enumerated all of our APIs optional parameters, which is also good because I don't have to reference docs; however, I don't want GET and POST requests to send the params when I haven't explicitly set the values. Is there a way to configure PAW to not send URL Params when they have no value? One option is to just duplicate an item and then prune the list, but it seems reasonable that there should be a way to simply ignore items that aren't set.
For example:
Don't GET:
http://domain.com/api/v1/users?maxResultCount=&isActive=true
(because maxResultCount is optional and not set)
Instead, do GET:
http://domain.com/api/v1/users?isActive=true
The current release, Paw Version 3.0.7 (Retail) now provides checkboxes on URL parameters.

How to populate google analytics UTM variables manually

I want to be able to set the UTM variables manually
So instead of having a webpage
http://mysite.net/index.html?utm_source=source&utm_medium=inbound&utm_campaign=campname
I want to be able to set these with javascript. Looking through the documentation I couldn't find any set methods for these, only the set key methods.
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCampaigns
I have also tried
_gaq.push(['_trackPageview', '/index.html?utm_source=source&utm_medium=inbound&utm_campaign=campname']);
Although as far as I can tell this doesn't work. The only way I can now see of getting this to work will be to set these using a hash value:
ie:
http://mysite.net/index.html#utm_source=In+House&utm_medium=email&utm_campaign=Fall+email+offers
_gaq.push(['_setAllowAnchor', true]);
Is there a better way?
edit
Actually it seems there IS a way to do this using GA code!
previous answer
I've needed to do this in the past as well and I could not find any way to do it on-page. I believe the only way you can really do this is by reading GA's __utmz cookie and rewriting the cookie with the value(s) you want.
example:
This is what __utmz would normally look like on if you go to www.mysite.com with no url params (the numbers in the cookie will be different):
URL: http://www.mysite.com
__utmz cookie value: 97566023.1329384140.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Here is what it would look like if you were to go to the URL with the values in the URL (the official way to do it):
URL: http://mysite.net/index.html?utm_source=In+House&utm_medium=email&utm_campaign=Fall+email+offers
__utmz cookie value: 97566023.1329384140.1.1.utmcsr=In House|utmccn=Fall email offers|utmcmd=email
And the cookie will have these values on subsequent page views, and you will see them sent to GA in the utmcc URL param in the request URL. So basically you can alter the __utmz cookie to the values you want. Would probably be more convenient to write a wrapper function to easily set it. Honestly, I don't know why GA doesn't provide a way to do this with a baked in wrapper function...

Documentation for Google maps MarkerImage url string in constructor

The first argument of the google.maps.MarkerImage class constructor is a url string with several GET variables.
This is an example of the url string in use. The color variable is clear, but what do the other variables do?
Yes, what Trott says. Basically the markerimage URL is a relative or absolute url to an image, nothing more or less. So depending on where you get your images from, it might have a querystring on it (e.g. if the marker is to be dynamically generated by a server-side script). So in this case you just happen to be using the Charts API to get a dynamic image for your marker.
The first argument is not necessarily a URL string with several GET parameters. It is simply a URL string. Google Maps API uses that URL to retrieve the image. If there are GET parameters, they are used (or ignored) by the server from which the image is being retrieved.
The example you link to contains a URL using Google's Charts API. The definitions for the parameters are at http://code.google.com/apis/chart/image/docs/chart_params.html.

Resources