MobileFirst Analytics Creating a Custom Chart - ibm-mobilefirst

I wanted to see how many times users visited that certain screen/page of my application using MFP Analytics. I'm wondering if I can use the analytics logs and make a log per screen and create a custom chart for the logs?
I based my assumptions on this mobilefirst tutorial:
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.0/moving-production/operational-analytics/

Yes, you can use the following to log the page.
WL.Analytics.log({page: 'pageA'}, 'Custom event for visiting page A');
WL.Analytics.send()
Then you can send it to the analytics console with WL.Analytics.send().
You can use a setTimeout function if you want to send it immediately after logging, so that you can ensure that there is time for the log to write to the disk before it is sent.
setTimeout(function () {
WL.Analytics.send();
}, 300);
Then you can create a custom chart in the analytics console with custom activities, property "page."

Yes, you can do this. It is as simple as creating a custom event such as "page X was visited" and on every load of a page, log the action (of loading it) and then send it back to the Analytics server. You can then splice your analytics data per page (event).
You can see this explained and demoed in the following:
https://mobilefirstplatform.ibmcloud.com/blog/2016/01/22/howto-custom-in-app-behavior-analytics/ (blog + video)
collecting custom data: https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.monitor.doc/monitor/t_collecting_custom_data.html (documentation)
creating a custom chart based on it: https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.monitor.doc/monitor/t_creating_a_custom_chart.html (documentation)

Related

How to remove sign-in restriction from Google Form programmatically?

I am creating Google Forms programmatically with a Google Script project.
DriveApp is used to grant view access to anyone with a link.
var form = FormApp.create("Test form");
var formFile = DriveApp.getFileById(form.getId());
formFile.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
However the Form still requires "anyone" to sign-in and it's restricted to my G Suite domain users. I've tried to find how to disable this but I don't know how the feature is even called in Google Scripts.
See the attached image with a checked box:
Note: I can disable the sign-in requirement manually. But Forms are delivered to respondents automatically and there's no time to do this manual step.
I haven't had to do this, so I'm not sure if it's what you need, but have you tried using the setRequireLogin(requireLogin) method when creating your forms?
See https://developers.google.com/apps-script/reference/forms/form#setRequireLogin(Boolean)

How to prevent Facebook Pixel to track the same transaction twice?

In my Purchase confirmation page, I send the purchase info to Facebook. But if my user hits Refresh, the data is sent again and Facebook compile the purchase values twice.
With Google Analytics, we can send a Transaction ID and even if the user refresh the page, the data is compiled only once.
Is there a way to achieve the same thing with Facebook? I would prefer to let Facebook do the job instead of having a flag on my side to send the Pixel only once.
Thanks
I solved this issue using sessions. Before you render purchase page you can set some session flag which trigger rendering FB pixel code (or whathever) => after rendering this code you can remove this session. If your customer refresh page session will be not set so your FB pixel code will be not rendered twice.
I used this idea in my extension for Nette framework:
Eflyax/facebook-pixel
I also was looking for a similar feature to Google Analytics's Transaction ID to deduplicate events.
So it turns out that Facebook does have such a parameter. Facebook calls it the eventID and it's used like this:
fbq('track', 'Purchase', {value: 12, currency: 'USD'}, {eventID: 'EVENT_ID'});
You can find the documentation of this parameter here: Facebook docs

Is it possible to exclude links from tracking

I am building an app which is utilizing Sendgrid Marketing Email API, with the purpose of sending newsletters. It has a number of links to articles, but also banner ads and other service links. We would obviously like to keep tracking of article links, but exclude other links from affecting the click rate. Is it possible in any way to mark links which we don't wish to add to tracking?
Minor thread necromancy to let anyone who gets here via google know that they added an attribute to disable link tracking.
https://sendgrid.com/docs/Classroom/Track/Clicks/click_tracking_html_best_practices.html
Click tracking can be turned off for individual links by including the clicktracking=off attribute inside the anchor of an HTML link before the href. For example, <a clicktracking=off href="http://example.com">link text</a> would not be tracked.
The current click tracking application for SendGrid overwrites all links and there isn't, at this time, a way to customise this so only certain links are tracked.
One alternative would be to turn off the Click Tracking app in your SendGrid dashboard, but switch on the Google Analytics app (under Apps > Show Disabled Apps > Google Analytics).
With this app switched on, you can then build out custom links that you want to track using the Google Analytics URL Builder.
This would stop SendGrid rewriting all the URLs, and allow you to specify URLs that you want to track. However it would mean you will lose click event data in your SendGrid analytics, and via the Event Webhook, but the important data that you want to track for your campaigns would still be stored in Google Analytics.
You can also disable Sendgrid's tracking using the api. To do this you set some email headers.
Example X-SMTPAPI header value:
{
"filters" : {
"clicktrack" : {
"settings" : {
"enable" : 0,
"enable_text" : false
}
}
}
}
This works for plain text emails.
See: https://sendgrid.com/docs/for-developers/sending-email/smtp-filters/#filter-clicktrack
1.To disable tracking for a specific link add clicktracking=off before href
eg: <a clicktracking=off href="http://destination-domain.com">text</a>
2.To disable sendgrid link tracking for all mails
Goto Settings -> Tracking -> Click Tracking -> turn off link tracking

Best way to create user notifications on webpage in ASP.NET MVC 4 Razor

tl:dr -> User notification system on website. Can you avoid the need to call a javascript script to render notifications after ajax loads? (a base view that calls it would work, but there are no base views afaik)
I am looking for a way to add a User Notification System to my website. Such system would be responsible for displaying messages like 'Import success', 'Import failed', 'Session timed out' etc.
I know similar questions have been answered before, but here's my question:
How should I do it to get as close as possible to having the notifications display themselves as soon as possible after being put to TempData? Having them rendered on _layout page would work, but only for requests that ask for whole page. What about loading only parts of website through ajax -> can I avoid having to write JS script in ajax callbacks or partial views?
I am looking for something to prevent writing multiple calls to same function.
Toastr is your notification Friend. Demo Page
you can install it from Nuget Install-Package toastr
See my SO question - for reference

Communication Between WebView and WebPage - Titanium Studio

I am working in a Mobile project (using Titanium Studio), in which i have the below situation
1) My Mobile app contacts Rails backend to check some data, say check validity of a
user id.
2) I found a way to load web pages in Mobile app, i.e., WebView
3) I could able to load the desired url, ex http://www.mydomain.com/checkuser?uid=20121
which would return data like status:success
But i need to read this data to show whether the response from server is a success or failure, how do i achieve this?
NOTE : The above mentioned scenario is an usecase, but actually what happens is i load a third party url in WebView and when user enters the data and submits, the result will be posted back to my website url.
EDIT : So the process is like below
1) WebView loaded with third party url like http://www.anyapiprovider.com/processdata
2) User will enter set of data in this web page and submits the page
3) The submitted data will be processed by the apiprovider and it returns data to my web page say http://www.mydomain.com/recievedata
This is the reason why i am not directly using GET using HTTPClient
FYI : I tried to fire Ti.APP events right from the actual web page as suggested by few articles, but most of them says this will work only if the file loaded is in local and not a remote file. Reference Link
Please suggest me if my approach has to be improved.
Thanks
If you don't want to follow Josiah's advice, then take a look at the Titanium docs on how to add a webview.addEventListener('load',... event listener and use webview.evalJS() to inject your own code into the third party HTML.
Maybe you can inject code to trap the submit event and fire a Ti event to trigger the downloading of data from your website.
Communication Between WebViews and Titanium - Remote Web Content Section
I found a solution for my problem
1) Load the http://www.mydomain.com/checkuser?uid=20121 in a webview
2) Let user enter and submit data to third party url
3) Recieve the response from third party url and print only <div id="result">status:success</div> in http://www.mydomain.com/recievedata page.
4) Add event listener for the web view as follows
webView.addEventListener('load', function(data)
{
//Add condition to check if the loaded web page has any div with id = result (to check if this is /recievedata page)
alert(webView.evalJS("document.getElementById('result').innerHTML"));
});
The above alert would print the result status:success, read it in webview load event
and take actions in web accordingly.
It works fine for me.
Instead of loading it in a WebView why not just GET it using a HTTP Client? This is much cleaner, and more standards based:
var xhr_get = Ti.Network.createHTTPClient({
onload : function(e) {
// Here is your "status:success" string
var returnValue = this.responseText;
},
onerror : function(e) {
Ti.API.info(this.responseText);
Ti.API.info('CheckUserProgressOnActivity webservice failed with message : ' + e.error);
}
});
xhr_get.open('GET', 'http://www.mydomain.com/checkuser?uid=20121');
xhr_get.send();