Search code examples
google-analyticsnewrelicwebsite-metrics

What is the best method to measure site visits and page views in real time?


I currently use Adobe Omniture SiteCatalyst, Google Analytics, and New Relic. All three offer visit and page view metrics. SiteCatalyst has no API that I'm aware of, and their data is often hours behind. Google Analytics and New Relic both offer realtime APIs, but I find that the metrics offered differ wildly across vendors.

What's the best method (API) for measuring realtime visits (page views, unique visitors, etc.)?

Ultimately, I intend to use this data to present realtime conversion rates to my business customers.


Solution

  • Adobe SiteCatalyst does have a realtime api that you can use. It functions in a similar way that reports in SiteCatalyst work.

    Here is python example request:

    import requests
    import sha
    import binascii
    import time
    
    your_report_suite="ReportSuiteId" #The name of the report suite
    what_you_are_looking = "someValue"  #value of a the prop that you want to find in the realtime stream
    
    def getRealTimeUsers():
        if mobile:
            url = 'https://api.omniture.com/admin/1.3/rest/?method='
            headers = {'X-WSSE': self.generateHeader()}
            method = 'Report.GetRealTimeReport'
            report_url = url + method
            payload = {
                "reportDescription": {
                    "reportSuiteID": your_report_suite,
                    "metrics": [
                        {
                            "id": "instances"
                        }
                    ],
                    "elements": [
                        {
                            "id": "prop4",
                            "search": {
                                "type": "string",
                                "keywords": what_you_are_looking
                            }
                        }
    
                    ]
                }
            }
            response = requests.post(url=report_url, headers=headers, data=json.dumps(payload))
            data = response.json().get('report').get('data')
    
       def generateHeader():
            # Generates the SC headers for the request
            nonce = str(time.time())
            base64nonce = binascii.b2a_base64(binascii.a2b_qp(nonce))
            created_date = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.localtime())
            sha_object = sha.new(nonce + created_date + self.sc_key)
            password_64 = binascii.b2a_base64(sha_object.digest())
    
            return 'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"' % (
            self.sc_user, password_64.strip(), base64nonce.strip(), created_date)
    

    Note: Realtime reporting requires that the realtime feature is turned on in your report suite. Also the realtime reports are limited in their dimensionality. There is not a whole lot of documentation on the particular requests required but there is this: https://marketing.adobe.com/developer/documentation/sitecatalyst-reporting/c-real-time

    Also I highly recommend experimentation by using the api explorer: https://marketing.adobe.com/developer/api-explorer#Report.GetRealTimeReport