Adobe DTM to set query string in eVar and sProp - adobe

So normally I would use the s.getQueryParam(); to parse out my URLs for query strings that I've been using.
s.eVar8=s.getQueryParam('cid,pid,eid',':');
s.prop28=s.getQueryParam('Role');
But since DTM has that all built into it, how would you really define that? I know I can set a page load rule using the campaign variable, but what if I have multiple parameters separated by ":"
www.domain.com?cid=blah1:blah2:blah3&pid=blah4:blah5:blah6&eid=blah7:blah8:blah9
Is there something that I'm missing when using this approach? Should I be capture these values into a data element then passing the data element into a page load rule using an eVar or sProp?

For variables that only look for a single URL parameter:
Create a Data Element of Type URL Parameter. For Parameter Name, put e.g. "Role" (no quotes) for prop28. Alternatively, you can do the same thing below, for multiple.
For variables that look for multiple URL parameters:
Create a Data Element of Type Custom Script. Click the [Open Editor] button and in the code box, add the following:
var d=':',
p=['cid','pid','eid'],
v=[],c,l,q;
for (c=0,l=p.length;c<l;c++) {
q=_satellite.getQueryParamCaseInsensitive(p[c]);
if (q) v.push(q);
}
return v.join(d);
The d= and p= values are based on what you have for eVar8. This isn't 100% the same as AA's s.getQueryParam plugin but it's most of it; the parts you care about based on your posted code.
Reference the Data Element(s)
In the Adobe Analytics tool config, in the Global Variables section, you can add your prop(s) and eVar(s) there, using %data_element_name_here% syntax.

Related

In gatling, how do I validate the value of a string extracted via the css check?

I'm writing a Gatling simulation, and I want to verify both that a certain element exists, and that the content of one of its attributes starts with a certain substring. E.g.:
val scn: ScenarioBuilder = scenario("BasicSimulation")
.exec(http("request_1")
.get("/path/to/resource")
.check(
status.is(200),
css("form#name", "action").ofType[String].startsWith(BASE_URL).saveAs("next_url")))
Now, when I add the startsWith above, the compiler reports an error that says startsWith is not a member of io.gatling.http.check.body.HttpBodyCssCheckBuilder[String]. If I leave the startsWith out, then everything works just fine. I know that the expected form element is there, but I cant confirm that its #action attribute starts with the correct base.
How can I confirm that the attribute start with a certain substring?
Refer this https://gatling.io/docs/2.3/general/scenario/
I have copied the below from there but it is a session function and will work like below :-
doIf(session => session("myKey").as[String].startsWith("admin")) { // executed if the session value stored in "myKey" starts with "admin" exec(http("if true").get("..."))}
I just had the same problem. I guess one option is to use a validator, but I'm not sure how if you can declare one on the fly to validate against your BASE_URL (the documentation doesn't really give any examples). You can use transform and is.
Could look like this:
css("form#name", "action").transform(_.startsWith(BASE_URL)).is(true)
If you also want to include the saveAs call in one go you could probably also do something like this:
css("form#name", "action").transform(_.substring(0, BASE_URL.length)).is(BASE_URL).saveAs
But that's harder to read. Also I'm not sure what happens when substring throws an exception (like IndexOutOfBounds).

Dynamic Url in Jitterbit Http Target

I am wanting to call the following URL in my Jitterbit HTTP target:
https://xxx.visualstudio.com/DefaultCollection/_apis/wit/workitems/[vstsId]?api-version=1.0
where [vstsId] is dynamic and should be supplied from a global variable.
Is it possible to have dynamic urls in the target?
I could make the whole url dynamic if need be.
Any ideas? (I'm using javascript scripting rather than the Jitterbit scripting)
Thanks
Martin
Yes, you have it typed out correctly. At the beginning of your operation chain (or at the point where you know what $vstsld should be, and you can declare it), simply add a script to declare it, or add it into a transformation where you get the data from. At any point after that, in the current operation chain, you can access the value in that variable. Just make sure you set it with the $ symbol, which makes it global.
$vstsld='some value';
As W3bguy said. you call it in the script as $vstsld. Now you can pass in a test value data into your variable as well. just add the curly brackets inside your variable like the below
example
https://xxx.visualstudio.com/DefaultCollection/_apis/wit/workitems/[vstsId{1234}]?api-version=1.0

Can you pass URL parameters to a sidebar gadget when adding it to google calendar?

Where the typical URL to add an html content type gadget would be
http://www.google.com/calendar/render?gadgeturl=http://www.example.com/hello.xml&nocache=1
can query parameters be appended to this (for tracking entry vectors) that won't be stripped by the container? Or can you arbitrarily set the module ID (query param "mid") to use it for this purpose? I've unsuccessfully tried appending "mid=[value]" and, in the gadget's javascript,
var moduleId = new gadgets.Prefs().getModuleId();
This returns the default value (0) regardless of value passed for mid. mid and all custom variables are stripped, as can be seen inside the gadget iframe in the "url" parameter value of window.location.href.

Jmeter how to get the dynamic parameter value in the path

JMeter path contents some dynamically generated value.
Eg
[HTTP Request]
[path-home/user?p=er3562]
This "p" value is dynamically generated.
I want to get this parameter value in the first HTTP request path.
This parameter value should pass through each HTTP request path.
I am new to JMeter. Please help me to solve this?
You need to extract it somehow and convert into a JMeter Variable for later reuse. JMeter provides several PostProcessors for extracting data from different responses types, in your case the most suitable one will be Regular Expression Extractor.
Add Regular Expression Extractor as a child of the request which returns that path-home/user?p=er3562 value
Configure it as follows:
Apply to: depending on where the "interesting" value lives, the most "safe" setting is Main sample and sub-samples
Field to check: depending on where the "interesting" value comes from, in the majority of cases it's Body but in your case it may be i.e. URL
Reference Name: anything meaningful, it is JMeter Variable name, if JMeter finds anything it will store the result in a variable named accordingly to this field. I.e. path-home
Regular Expression: Perl5-style regular expression, in your case it would be something like: path-home/user\?p=er(\d+)
Template: if you're looking to extract a single value it will be $1$
Refer extracted value as ${path-home} where required.
References and tips:
You can use Debug Sampler and View Results Tree listener combination to view JMeter Variable names and test regular expressions against actual response
Using RegEx (Regular Expression Extractor) With JMeter
Perl 5 Regex Cheat sheet
JMeter Regular Expressions
By using correlation concept ,
regular expression extractor concept & try this key
p=er(.*?)

Is there a way to batch upload URLs as Triggers into Google Tag Manager?

I have a list of a 100+ unique URLs and I want to use them as Triggers for a couple different audience tags. Sadly they have no common path thread that could be used to shorten/batch the process. Currently I am making each one into a path Trigger and then assigning it to the proper audience. It would be great if there was a way to upload a group of them to one trigger as an "or" type list, or to batch upload them as different triggers and then assign them to each tag individually.
After re-reading the question, this might be a good job for a lookup table. Input variable would be page path and you would be setting the output value to true if the path is matched by your urls (and false as the default value). Then all urls are in one place and you'd need to assign only one trigger to your tags.
Alternatively you can use 'Some Page Views' and 'matches RegEx':
Make a list of all URLs and remove the protocol, subdomain, domain name and slashes from them all (so 'https://www.example.com/my-page/' becomes 'my-page' without quotes).
Put all of these partial URLs into a list separated by |
So: |my-page-1|my-page-2|my-third-page|
Create a Page View trigger
Select 'Some Page Views', then...
Page URL, matches RegEx, [paste list of bar separated partial URLs]
Save
Google Tag Manager using matches RegEx to find generic 'terms of service' and 'about' style pages

Resources