• Johnny Baillargeaux
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Senior Manager Architect
  • CCEP


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi,

I have created an e-commerce site and enabled google analytics by setting the tracking code field on the site config page in salesforce. My page template uses the site component <site:googleAnalyticsTracking/> and the data are exposed to my GA dashboard as expected.

I just have one issue with one specific page. The checkout process (5 steps) is in reality just 1 visual force page with the same URL accross the different steps therefore, for this specific part of the site, I cannot create reports to check on which step the user decided to leave or any other similar requirement like this.

When I look at how site:googleAnalyticsTracking is rendered on the output HTML, i can see the following javascript injected:
 
try {
          var pageTracker = _gat._getTracker("<my tracking code>");

          pageTracker._setCookiePath("/cp");
        pageTracker._trackPageview();
     }
     catch(err) {
     }

By looking the GA documentation (https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiBasicConfiguration?csw=1#_gat.GA_Tracker_._trackPageview), I can see that we can force a URL.

How to do it because the javascript is populated automatically because of the GA site component. Worst case, I can try to overwrite the value by injecting "pageTracker._trackPageview('Step1')", pageTracker._trackPageview('Step2),etc... on the click event for each of the next/back buttons visible at the bottom of my checkout process but is there a way to do it more properly?

Of course an option would be to create 1 page per step but this is a real complex checkout process with a lot of call to outbound API and it will require a lot of refactoring and rewrite the test classes.

Any help or guideline would help me a lot. Thanks in advance for your help.

Cdt.
We created a simple iOS native app, which should allow users to login into SF once and then open Lightning community app in a Webview. For this purposes we have below steps:
1. User launch the mobile app;
2. App calls Mobile SDK, which redirects to community login page, where user enters login and password; That allows us to get and refresh session token if this is required.
3. We get an authorization token and passing community URL + token into WebView.
4. We tried to pass authorization token as a parameter like:

let request = try! URLRequest(url: URL(string: "<Link to community page>")!, method: .get, headers: ["Authorization" : "Bearer \(token!)"])
or using frontoor.jsp.

both ways works fine when I try to open classic SF page or application. But when I try to open Community page it asks login again. So that means that those ways does not work with a community pages.
So how can I pass authorization token to a Webview for a community users? Any help would be appreciated! Thanks!