Branch.io custom event count not increasing for quick links - branch.io

I have created a quick link from https://dashboard.branch.io/quick-links. When the user opens the link and tries to register the account on our website, a custom event is triggered from server side (Java) using the branch http API.
I can see that event in the Liveview section of Branch.io dashboard. But, when I go to the quicks section, the count for my custom event column is always showing as 0.
Is there any specific Branch related parameter that I need to send from client side (browser) to server side while submitting the form, to let Branch know that the custom event should be linked to a specific link, so I can see the custom event count increasing for that link in quick links section.

Your custom event will not be attributed to your link click if you trigger the event on the server side.
You should trigger the custom event from the client side post registration. You can put this in the callback of your registration method. If you navigate away from the initial redirect to your webpage, make sure that page has the Branch Web SDK initialized, and that you have the _branch_match_id(found in the address bar of your redirect) appended to your web url. This _branch_match_id is what Branch uses to attribute the custom event to your link click.
https://docs.branch.io/pages/web/integrate/#track-events

Related

Blocking some GTM tags when running TestCafe tests - use the dataLayer?

Wondering the best way to prevent a GTM tag from firing. I found https://rbardini.com/automating-gtm-data-layer-tests/ which tags about fetching the dataLayer variable and comparing it in an assertion, but this looks like a clumsy approach when you want to write to the dataLayer on every page.
For example, it suggests:
const getDataLayer = ClientFunction(() => window.dataLayer)
We use Google Tag Manager to automatically load tags on our website. Unfortunately one of them is CloudIQ (from PayPal) which pops up an iframe overlay offering a newsletter signup or ability to save your shopping basket. The Trigger in our GTM setup for that tag is simply 'All Pages'. When it pops up it generally blocks our test because Selectors cannot be clicked.
Our page flow is over several pages of an online shop, e.g.:
visit home page, click a product - navigates to a product page
click some options on the product page, then add to cart
go through checkout flow
So there might be many pages visited due to click actions.
There is an ability in GTM to define Variables and then use them in Exceptions for a tag, so I could prevent the CloudIQ tag firing either via a/ a global variable or b/ a dataLayer variable. However, I can't see how to elegantly get these set for each page visited during my test, such that they would exist when the GTM examines variables in order to block a Tag from being loaded. Fixture.beforeEach isn't right because it would only run once per fixture, and any data it set on the page's scope would be lost as soon as a page navigation occurs.
Anyone got experience of this sort of thing?
(The alternative of course is to detect the overlay, use switchToIframe to switch into the CloudIQ iframe and close it manually, but it pops up quite erratically and I'd prefer to simply disable the Tag altogether during tests as it's not core functionality of our website that we need to test.)
One way would be to set a custom user agent string to your test suite, create a custom javascript variable that returns the value for navigator.useragent, and make an exception trigger that blocks the tag.
Or any variation on that theme - set a cookie, use a url parameter, or if you test suite allow inject a global js variable, and check for the value in an exception trigger.
There is no need to avoid firing of events on the client side. Just mock the service routes for Google Tag Manager and CloudIQ and imitate correct responses for them.

WKWebView - replace web action

Inside my app, I'm using the WKWebView to display a website. My goal is, when user is pressing a button on this website, I want to stop an action linked to this event and replace it with my own, natively made (custom action outside the WKWebView). I've been trying to search for any solution to fetch mentioned event but unsuccessful. What more came to my mind, if there is a way to fetch a JavaScript in WKWebView, I have a possibility to add some JS script code to this site (not to delete the action I want to block). Thank you for any help.
First, do you have a permission to mess with this web site's behaviour? I assume you do, otherwise it is likely illegal.
Second, try using Safari Web Inspector with a device/simulator, and use the DOM tree and console tools to find out what is the HTML/javascript that is involved with this action on this site.
If you can't find what happens in HTML/JS yourself, feel free to post a new separate question on SO with your target URL, some HTML/JS code, and which link/action you want to replace. Tag the question with "javascript" and ask if it is possible to write some javascript to replace that particular action to some custom JS code.
Usually there are 2 types of actions: either it is something that provokes AJAX calls to a server API triggered by an event handler, or it is a plain HTML link that results in a web navigation. For both cases it is possible to write a JS script that overrides the action.
Finally, use WKUserScript to inject javascript into the page, and override the action. Use window.webkit.messageHandlers to send an event from your custom action to the app side. Use WKScriptMessageHandler to process the event in the Objective-C or Swift code.
See an example here: http://nshipster.com/wkwebkit/

Navigating elm from URL without destroying state (elm 0.18)

I have an elm app that incorporates logging in and fetching data from a server. Once I've logged in, I navigate to /#/pages/13 and it updates the model with page id 13. If I click around within the app, I see evidence that that page persists in the model.
When I navigate away from that page via internal links, then enter http://localhost:3000/#/pages/13 into the URL, I still see that page.
If I enter that URL while I am at that location, it seems to treat the behavior as a complete refresh, resetting the model...including my token, so it logs me out.
How can I enter the same page into the URL without elm resetting the model?
(If it matters, I am using gulp)
That behaviour seems to be by design, although I didn't find an official source for this.
The most you can do is register a beforeunload listener, which might show a prompt allowing the user to cancel the navigation.
Related: https://stackoverflow.com/a/34415095/2014893

Capture the browser's back button in an MVC4 web application and execute a Controller's Action

We have developed an MVC4 Web Application. Due to the flow of pages (it is a reservation system) we need when the user pressed back button the page to be executed again ie reload data from database as it was called from first time.
May be a solution is to suggest how to Capture the browser's back button in an MVC4 web application and execute a Controller's Action
Kindly consider.
Any assistance is kindly appreciated.
Based on your comments it seems you are building up state over several pages (in a wizard style) and it is when navigating back to an earlier page that you would like the state to be cleared.
You would need to capture the page navigation logic on the server side and not rely on capturing back button events on the client side.
You should use the state you've captured to determine what should be displayed to the user and what should happen to the current state you have.
For example, imagine you have pages A, B, C, D which collect user information. The user has entered information on pages A and B (which has been gathered in the session or the database perhaps) and is now on page C. They then navigate back to page A (via the back button or by modifying the url directly). At this point (in the controller for page A) you can determine from the current state that they have been to page B and therefore deduce that they must have navigated back. You can therefore clear the state at this point or perform whatever logic is required.

Open graph: custom actions

I created a custom action and object.
The only problem I have is when publishing to FB, clicking on the icon or on the title redirect the user to a blank page instead of my application.
Where can I set the redirect link?
The only url I see is the one in the opengrap html but this one is suppose to be the adress of the og wright? (
This link might help.
Basically, when the opengraph action is executed by your app, it sets the url that represents the object (which provides all the metadata for the object) and is also the URL that a user is sent to when they click the action in facebook.
E.g. https://graph.facebook.com/me/[YOUR_APP_NAMESPACE]:cook
?recipe=OBJECT_URL&access_token=ACCESS_TOKEN
In this case, the cook action is being called, with a recipe object with the given OBJECT_URL. At that url, a page should exists (generated by you), with all the facebook metadata in the head tag so that the object can be correctly created, but also with actual web page data for the user to view.
Another link worth looking at for a working example is here