How do i set an eVar value in Adobe Analytics? - adobe-analytics

I couldn't find an answer to my question anywhere so i decided to post it here.
So, we have eVar33 set up within adobe analytics, when someone submits a form on our website how do i set eVar33 equal to the email address field?
$("form").submit(function(){
$("input#email").val(eVar33);
});

I'm assuming you have an appmeasurement library (aka s_code) on your page. In that case, Crayon Violet is right, something like this is what you want:
$("form").submit(function(){
s.eVar33 = $("input#email").val();
});
That will set the variable. To send it to Adobe, you need to fire either s.t() (for a page view) or, as is more likely the case for you, s.tl() (for things you want to track not associated with a page view- https://marketing.adobe.com/resources/help/en_US/sc/implement/function_tl.html and https://marketing.adobe.com/resources/help/en_US/sc/implement/link_variables.html.)
I suspect in the end, you'd do something like this:
$("form").submit(function(){
s.eVar33 = $("input#email").val();
s.linkTrackVars="eVar33"
s.tl(this,"o","form submitted")
});

Related

Set the Visitor ID in Adobe Analytics through DTM

I'm trying to set the Visitor ID in Adobe Analytics through DTM.
Above the s_code I have:
var visitor = new Visitor("xxxx")
visitor.trackingServer = "xxx.xx.xx.omtrdc.net"
I've created a data element where the legacy code used to call the
Visitor.getInstance("xxxx");
and set the Visitor ID to %Visitor ID%
That's not working however, and my visitor ID is always just set to %Visitor ID% and obviously not reading any values. I'd really appreciate any input that someone can give me.
Thanks,
Mike
The Visitor ID pops s.visitorID and is in general related to visitor id, but is not the same as s.visitor which is what gets popped for the VisitorAPI integration. DTM does not currently have a built-in field for the s.visitor variable, so you will have to set it yourself within the config, either in the Library Management code editor (assuming you are opting to c/p the core lib and not the "Managed by Adobe" option) or else in the Custom Page Code section.
Since you are popping it in a data layer first, you can reference the data layer like this:
s.visitor = _satellite.getVar('Visitor ID');
NOTE: A separate potential issue you may have is with whether or not the Visitor object is available for your data element. Since data elements are the first thing to be evaluated by DTM, you will need to ensure that the VisitorAPI.js library is output before your top page DTM script include.
If this is a problem for you, or if you are wanting to host VisitorAPI.js within DTM, then you may need to adjust where you are popping that stuff. For example, place the VisitorAPI core code above the custom code as the first stuff within the data element, before:
var visitor = new Visitor("xxxx") visitor.trackingServer = "xxx.xx.xx.omtrdc.net
Or, don't use the data element at all. Instead, put the VisitorAPI code within the Adobe Analytics custom code or core lib section and pop all that stuff (aboove the s.visitor assignment). Or a number of other methods; point is, VisitorAPI stuff must be loaded before the data element can make use of it, same as it must be loaded before Adobe Analytics can make use of it.
So DTM is changing pretty fast and furious right now. They have a "Marketing Cloud Service ID" that works well. Before I used that, however, I did find a way to fix the code. Crayon Violent was right, as usual, that the problem was that the script wasn't available yet. I fixed this by putting the following code in between the VisitorAPI.js and the AppMeasurement stuff in the DTM managed library.
var aA = new AppMeasurement();
aA.visitorNamespace="companyname";
aA.visitor = Visitor.getInstance("companyname");
In addition, there were also some issues using my localhost for testing while trying to see if I had this correct or not. If you are having issues and think you have it correct, it may be worthwhile to elevate it to a different environment.

JQGrid: How to override saveparameters url for inlineNav addRow?

I need to explicity specify the url for adding a row via inlineNav.
But, I do not know HOW to do that, other than something called saveparameters has the url value I need to specify, documented here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing&s[]=addrowparams
However, function that uses that is saveRow, and that is called by inlineNav save button using default saveparameters, which has wrong URL (the window location, because grid has not editurl specified).
QUESTION: How can I configure jqGrid saveparameters with the url my inlineNav save button needs?
I could put 8 or 10 URLs here showing many asking same question and no answer. Is this stupid question, or not supported or possible?
Any help much appreciated.

Google Analytics iOS. How to use -send:params: ?

API version is GoogleAnalyticsiOS_2.0beta4.
The problem I'm dealing with is next:
f.e. I have several screens with one of them called PagesScreen.
PagesScreen have several pages.
In addition to screen tracking, I wish to track pages visited by user.
If I use custom dimension, f.e. pageName in conjunction with
[tracker sendView:#"Page View"], obviously, each time page changes, page visits being added to screen visits with #"Page View" screen name. I don't want to page views statistics being mixed with screen views. Therefore I don't have to call sendView: API. sendEvent: API is also not suitable for my case.
The remaining method is:
- (BOOL)send:(NSString *)trackType params:(NSDictionary *)parameters;
But neither it's description tells me about usage, nor mentions I've found in iOS integration guide.
What is trackType and what is parameters structure? Does anybody knows how to use it?
I think you can find the allowed trackTypes and required parameters on the following page:
https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
For instance, to send an event via send:parameters, the trackType should be #"event" and should have the following keys/values:
&ec=video // Event Category. Required.
&ea=play // Event Action. Required.
&el=holiday // Event label.
&ev=300 // Event value.
Hope this helps!

symfony 1.4: two questions about sfDoctrineApplyPlugin (well, could be also considered as general questions)

I have found in sfDoctrineApplyPlugin a template called applyAfter.php
that shows a message like "You have registered ok..." after the users apply for an account. It is called from the sfApply/apply action this way: "return 'After';" when the apply form is valid.
What kind of template is that? I never saw that way (return 'After';) of calling a template. Can someone give me info about that?
Second question: I show a layout with a language select when the the
apply form is printed. I wouldn't like to show that language select in
the page that shows the message "You have registered ok...". As the action
is the same in the both pages (sfApply/apply), what should i do to hide
the language select in the verification page?
Javi
The function returns the string 'After' to the caller. The caller always seems to be as follows: $this->widgetSchema->setNameFormat('sfApplyResetRequest[%s]');
So, the string 'After' is being used in conjunction with the setNameFormat function (which is part of the symfony libraries). All it is doing, is setting the 'name' attribute for the form. More information on this function here.
For your second question, you could simply add an IF statement, to check to see if the current route is the one that you do not want to display the language select on. If it isn't, then display the language select.
You can verify the current route with the following code:
sfContext::getInstance()->getRouting()->getCurrentRouteName();

.Net MVC: Set Model property from Javascript

So this seems like it should be simple. I'd like to set a public model property from javascript that's fired on the mouseover of an image.
So something like this:
Html:
...img src="<%=Model.AppDetails.Logo%>" onmouseover="showMenu(this);...
Javascript:
function showMenu(app) {
<%Model.CurrentId = app.id%> //app.id is of course undefined here
...
Or is a better approach to call a controller method to set it? If so what's the best approach? Ajax? Seems like a lot of heavy lifting for something so simple.
Appreciate the feedback.
Sharon
What exactly are you trying to do with Model.CurrentId? If you're trying to just send it back to the server when the page next sends information, use a hidden field or similar.
However, if you're trying to set a value on the server when the user mouses over an image, of course you need to use ajax or similar. How else is the server going to know what the client is doing.
If you want to use Model.CurrentId later in the same file, you will need to re-apply the template as well. Once the view is processed on the server, the client has no information from the template (the client doesn't see the <%...%> tags, those are replaced on the server before sending).
I can't imagine any scenario where you'd want to send information to the server on a mouseover unless you were going to also get information back (like an extended tooltip, or an image popup), so ajax is probably your best option.

Resources