Custom Dimension in Universal Analytics for URL ID - universal-analytics

I am trying to set up a custom dimension in Universal Analytics where the dimension includes a string within the URL as part of the name. For instance, the URI for the page that I need to render a custom dimension is this:
/job/location/job_title/1153/5544
I need to generate a custom dimension that would read:
Job View 5544 and all the metrics that generate from this.
What additional coding do I need to add to this script to pull that dynamic URL field?
ga('send', 'pageview', {'dimension1': 'Job View{URL ID}'});

Here is some javascript to get the 5th folder of a URL, which I assume is always the job number:
d = document.URL;
s = d.split('/');
ga('send', 'pageview', {'dimension1': 'Job View:'+s[7]});
Its s[7] as I assume it takes 2 from http://example.com plus the 5 '/' in your stem, but you get the point if it needs tweaking.

Related

how to extract parameters from Jmeter for web forms using redirection

Hi so my webform navigates from : http://43.252.88.109:4006/BracketICT/?t=aZCcbzidJJKfFgrkk1RYPH0zHTl+MtTuoGeiUw0hEw48nLZUoPrfntO29VV2daEiR3cPbu25/Xf2a3Q1UMZs1tAoUDti4wBVbYQbRHhhBDTt0Z1yTrWlkWKunP18DkVBkRSSVMdiHYyQ=&uniqueID=dGdck61pZFirpz9fA5FQZFhakSeoICZ9&dev=1696661 to
http://43.252.88.109:4006/BracketICT/examstart.aspx
]3
i.e. from the instructions page to exam start page on the click of ![the exam start button. My Jmeter response during recording shows that the link: http://43.252.88.109:4006/BracketICT/examstart.aspx
accepts two parameters i.e. attemptid or recordid. These values are generated on the location parameter of the examstart screen when the user clicks on starts test and lands on exam page. My response for http://43.252.88.109:4006/BracketICT/examstart.aspx does not show the location parameter on JMeter. How do i extract attempt id or recordid dynamically in this case during redirection ?]5
You need to:
Expand the 3rd sample result from the top in the View Results Tree listener
Switch to "Response Headers" tab
there you should be able to see the Location header and you will be able to extract these attemptid and recordid values using Regular Expression Extractor

How to handle URL containing slash within the input parameters

I am working on a Web Service, in which the URL is given with 2 inputs-- input1 & input2 such as . The input2 contains a slash within it like onj\hjk. When I hit the URL, it is considering as 3 input parameters which is supposed to be only 2. Can you please let me know how to handle this situation and how the code has to be changed accordingly
If you are generating the URLs from Javascript then use either encodeURIComponent(str) or encodeURI(str) .
But in case your are generating URLs through PHP then use urlencode() .
For details visit urlencode() and encodeURI(uri)

RESTFUL URLS in rails?

Hi I'm building REST api for an app, I have a requirement in URL
such that url should be something like this e.g
www.abc.com/api/param1/value1/param2/value2/param3/value3.... and so on
There are cases
case: The number of params are not limited it can change frequent
if today it is something like this
www.abc.com/api/param1/value1/param2/value2/param3/value3
tomorrow it can be like this
www.abc.com/api/param1/value1/param2/value2/param3/value3/param4/value4
Is there a configuration where once you configure the url pattern
and every thing go smooth
and in conrtoller params should contain this kind of key-value pair
{ "param1" => "value1","param2" => "value2","param3" => "value3"...and so on }
any suggestion !! how to achieve this ??
If your params are not fixed you can use wildcard in routing
for e.g
get 'items/list/*specs', controller: 'items', action: 'list'
def list
specs = params[:specs] # e.g, "base/books/fiction/dickens" #split it and place in a hash
end
Rails routing provides a way to specify fully custom routes with static and dynamic segments as explained in the Rails Routing Guide.
Your requirement should be achievable with
get '/api/param1/:param1/param2/:param2/...', to: 'controller#action'
You can use route scoping for this particular kind of problem . In other way it is nested routes
More details : http://guides.rubyonrails.org/routing.html#nested-resources
This is a example,
GET /magazines/:magazine_id/ads/:id/edit ads#edit
return an HTML form for editing an ad belonging to a specific magazine
I think this would be helpful for you.

I'd like to know how to change pages in Form Post

I'd like to know how to change pages by putting some in Forms by Post way.
http://www.aldoshoes.com/us/women/shoes/flats
in this page
How do I move to page 2 by putting some variabels in URL?
Please help me out.
This is not possible because it seems to me that the server does not handle GET parameters in the http request.
However it is possible to achieve this using POST parameters, either programmatically or using a plug-in for Chrome/Firefox (see Super User question).
The server accepts the following parameters:
formAction:
startRow:1
rowsperPage:12
flagID:
seasonID:
dimensionID:
sizeID:
colorID:
colorGroupID:
itemCategoryLevel1:1100
itemCategoryLevel2:1101
itemCategoryLevel3:1120
itemCategoryLevel4:
styleID:
styleDescription:
keywords:
alternateDescription:
descriptionDetail1:
descriptionDetail2:
descriptionDetail3:
onsale:N
sortBy:
itemFamilyID:
heelHeight:
To get to the second page of the shop you can set the parameter startRow to 13:
startRow:13
rowsperPage:12

Manage Titles when Uploading Multiple Images

It would be great if we could manage the titles of each image that we upload when uploading multiple images. This way I could select each image that I want to upload, title them, then hit the upload button. Right now one must either upload one by one or have all the selected images have the same title.
Kinda like Facebook or Panoramio where it's easy to manage the titles of the images before uploading.
This isn't natively supported in Fine Uploader at the moment, but I've opened up a feature request and tentatively scheduled it for the 3.7 milestone. In the meantime, you can certainly provide your own UI elements to allow users to provide alternate names for each upload-able item and pass these new names as a parameter. Server-side, you would have to parse this parameter and associate it with the uploaded item. Fine Uploader will have to adopt a parameter name that contains the user-supplied alternate filename anyway (and the server will have to be aware of this convention and parse this parameter), since we won't be able to change the value file input field sent along with the multipart encoded request.
use this:
var uploader = $('.uploader'),
titleBox = $('input[type=text]');
uploader.fineUploader({
request: {
endpoint: 'path/to/url'
},
formatFileName: function (name) {
var title = titleBox.val() + ' - ' + name + '';
titleBox.val('');
return title;
},
});
uploader.on('submit', function (event, id, name) {
uploader.fineUploader('setParams', {title: titleBox.val()}, id);
});