use google tag manager custom HTML tag to populate data on pages - variables

I have a question about gtm.
so currently I have created a script that can create all the data I need into datalayer this is how the data layer looks like (from page source code):
<script>
dataLayer = [{"visitorLoginState":"Logged out","visitorType":"NOT LOGGED IN","visitorLifetimeValue":0,"visitorExistingCustomer":"No"}];
</script>
but all this is generated from my store, but they key would be to be able to use these variables through GTM.
so inside GTM UI i created a custom html tag and added:
<script>
dataLayer.push({'event': 'visitorLoginState'});
</script>
I also created a custom macro->data layer variable with the name of "visitorLoginState" hoping that it would show "NO" instead of visitorLoginState in the response. but it just showing "visitorLoginState"

I am new to GTM too and getting to grips with it all.
From what I can see it looks like you are using macros and the dataLayer incorrectly.
You are running a script to add another row called event to the datalayer whilst already declaring what you want in the data layer. So initially the output in the source would be along the lines of:
visitorLoginState: Logged Out
visitortype: Not Logged In
ETC...
With the script you have added in GTM it would go to:
visitorLoginState: Logged Out
visitortype: Not Logged In
event: visitorLoginState
ETC
What you want to do is actually create a macro called visitorLoginState with the Type of Data Layer Variable, using the Data Layer Variable Name of visitorLoginState (and so forth).
From there you can create a Rule in GTM which will activate something based on what is returned in the data layer.
So your Rule could be:
visitorLoginState equals Logged out.
You could then have your script in the tags part of GTM which would say something like:
<script>
dataLayer.push({'event': 'No'});
</script>

Related

How can i manage a global variable among different webpages in wix?

I am developing a site for online test series. I receive details o student on one page and wish to display the info on net page as dashboard. I need a global variables that can hold the detail of student like his roll no, name, email, class, semester, subject and the test he wishes to solve.
I have tries using a separate .js file to hold variables. However, the values of variables get lost as i move to next page.
can anyone help?
The code and links are attached.
https://ishuuw.wixsite.com/ymatutor/test-series
//import wixData from 'wix-data';
import {globalVars} from 'public/vars.js';
$w.onReady(function () {
});
export function button2_click(onClick,button2){
globalVars.StudentRoll=$w('#input1').value
globalVars.StudentName=$w('#input5').value
globalVars.StudentSurname=$w('#input6').value
globalVars.StudentMail=$w('#input7').value
globalVars.StudentClass=$w('#dropdown1').value
globalVars.StudentYear=$w('#dropdown2').value
globalVars.StudentSemester=$w('#dropdown3').value
globalVars.StudentPaper=$w('#dropdown5').value
globalVars.StudentTest=$w('#dropdown6').value
//Just to test, this works well
$w('#text63').text=globalVars.StudentRoll
$w('#text64').text=globalVars.StudentName
$w('#text65').text=globalVars.StudentSurname
$w('#text66').text=globalVars.StudentMail
$w('#text67').text=globalVars.StudentClass
$w('#text68').text=globalVars.StudentYear
$w('#text69').text=globalVars.StudentSemester
$w('#text70').text=globalVars.StudentPaper
$w('#text71').text=globalVars.StudentTest
}
`
Sounds like you should be using wix-storage. That will allow you to pass information between pages.
Use local storage if you want the data to persist for the user even after the user ends the session. Meaning, next session, the user's data will still be available.
Use session storage if you want the data to be removed when the user's session ends.

Can we send multiple Properties in Json of Analytics(IBM MobileFirst)

I was asked for a usecase where I have to filter ActionEvents on type of Page that action is being is being called from.
Example
use case: I have a login page and I have to capture analytics of its events
Can I do something like this
String json = {"PageLevel":"LoginPage","ActionLevel":"LoginButton"};
WLAnalytics analytics=new WLAnalytics();
analytics.log(message, new JSONObject(json));
Will this work... can we create custom chart with first property being ActionLevel and filter it as per PageLevel.
No this will not work. Custom analytics can only be logged in key value pairs i.e. you cannot send two key value pairs in one JSON object. This is a good idea though, I recommend you submit an RFE.
Submit a Feature Request

Data not updated in dhtmlx .net scheduler

I have problems and questions about this scheduler. I already tried to build and almost finished it. Although, I receive some errors...
What I do?
I create custom lightbox
mapping all the data in to table dbo.bEvent
I used custom eventbox like this : Scheduler.Templates.event_text = "({position_desc})" + " " + "{newrate}"
position_desc is actually from other table 'dbo.zone'
I create Views in SQL Server to retrieve data from 'newrate'. 'newrate' actually is a new attribute after I do some query to change rate "1000 to 1k" which is new rate save '1k'.
the views that I create by joining table "dbo.zone and dbo.bEvent"
Problem is?
when I save a new data or insert or update new data. my event box just give me '(Undefine)undefine'
all the data that i put in lightbox is save in dbo.bEvent
after I resfresh the page using f5 or navigate to next page or previous page then the data is updated.
Here i attach some screenshot. Thanks in advance
http://s1319.photobucket.com/user/matpyam/library/?sort=3&page=1
If you save the changes as described here http://scheduler-net.com/docs/lightbox.html#define_crud_logic ,
note that the method uses SchedulerFormResponseScript class to render the response.
Constructor takes instance of the event class to be returned to the client. Values of that event will be applied to the related event on the client-side
return (new SchedulerFormResponseScript(action, changedEvent));
make sure object that you send (changedEvent) has all data properties initialized. Basically the event should have the same data as when it is loaded from the Data action.
Alternative solution, which may be more straightforward, would be reload calendar data with the client-side api after saving event:
scheduler.clearAll();
scheduler.load("dataUrl", "json");
http://docs.dhtmlx.com/scheduler/api__scheduler_clearall.html
http://docs.dhtmlx.com/scheduler/api__scheduler_load.html

How to use Global Property name in my JSON input request using SoapUI?

I have a SoapUI project which contains around 60 plus services. Each service requires some input which will be changed for every execution. So I have created certain Global Properties and assign some values to that properties.
I have to use these properties values in my SoapUI request ( i.e. JSON Format request ).
If it is groovy script means, I will use like this.
String HTiC_Username = com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['HTiC_Username'].value;
But, how to get the value of the Global Property in the request?
Hope you understand my question. Please provide proper guidance.
Thanks
To dynamically "expand" (i.e. substitute) the value of a property into a test step, the following syntax is used: ${#scope#propertyName}
...where 'scope' refers to the level at which the property has been defined (e.g. Global, Project, TestSuite, TestCase).
So to expand a property named username defined as a Global property, for example, the following code can be used directly within a Request Test Step (e.g within a JSON body, or header value, etc):
${#Global#username}
To access the same property value within a Groovy Test Step, you can use the following syntax:
context.expand('${#scope#propertyName}')
...as in the following example:
context.expand('${#Global#username}')
What we did was the following:
created a test data file to store all the specific input data for the different services (testdata.properties)
Example content of testdata.properties:
Billing_customerID=1234567
OtherService_paymentid=12121212
....
create a SoupUi global parameter (File/Preferences/Global properties): testdata_filepath=C:\...
For specific services we added a Properties test step. You can specify the "Load from" field to our new global parameter: ${#Global#testdata_filepath} Now you can use the Load button to load parameters.
Finally you can reference the parameter in your xml in the following format: ${Properties#Billing_customerID}
Example content of a service with parameter:
...
<BillingCustomerIdentification>
<BillingCustomerID>${#Properties#Billing_customerID}</BillingCustomerID>
</BillingCustomerIdentification>
...
To set up your projects in this manner also helps to automate service tests eg. using Hudson (see my previous SO answer).
If it is too heavy and automation is not a target, you can simply use ${#Global#someinputvariable} format in your xml ;-)

How to use a hidden page item within an SQL report query without submitting

Using: Oracle ApEx 3.0.1
I have a SQL report region that contains a hidden page item as part of the "where clause". My problem is, based on a value entered by the user, I need to assign this value entered to my hidden item, so that it can be used within the where condition of my SQL but this would need to be done without actually submitting the form.
At the moment, I can set the value via an on-demand process but my SQL is still not returning any values as the hidden page item within the query is not set (as page has not been submitted).
I am not sure how to do this and whether in actual fact, this is possible to do, without having submitted the page.
Since you are on Apex 3, you don't have dynamic actions, but that doesn't hinder so much.
I've set up an example on apex.oracle.com. To get in the workspace, use workspace 'tompetrusbe' + apex_demo / demo.
There is a dynamic action there, which can do the work too, but i've disabled it.
What you need to make it work:
an ajax callback process, with the following line:
apex_util.set_session_state('P2_PAR_ENAME', apex_application.g_x01);
Give your report region a static id, i called mine 'report_emp'. This so i can easily retrieve it.
In the javascript region of the page, you then need to call the app process, and then refresh the region. Also bind the event which needs to trigger this action. I've done it here through the onchange event of the parameter textfield.
function refresh_report(oTrgEl){
//alert('refresh: ' + $v(oTrgEl));
//calling the application process which sets the session state of P2_PAR_ENAME
var oGet = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=set_session_state', &APP_PAGE_ID.);
oGet.addParam("x01", $v(oTrgEl));
oGet.get(); //the app process just sets something, it returns nothing
//refresh the report region
$("#report_emp").trigger("apexrefresh");
};
function bind_events(){
//call this onload
$("#P2_PAR_ENAME").change(function(){refresh_report(this);});
};
In the query of the report i use where ename like '%'||UPPER(:P2_PAR_ENAME)||'%'.
When you type (for example) 'bl' in, and tab out (to trigger the onchange), the region will refresh and will be filtered.
You'll just need to adapt to your solution :)