Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide per-page results #12

Closed
tomdyson opened this issue Mar 14, 2016 · 1 comment
Closed

Provide per-page results #12

tomdyson opened this issue Mar 14, 2016 · 1 comment

Comments

@tomdyson
Copy link
Owner

e.g. in the settings tab. "This page has been viewed x times in the last 24 hours". Something like:

// https://developers.google.com/analytics/devguides/reporting/core/v3/coreDevguide

function makeApiCall() {
    params = {
        'ids': 'ga:81871816',
        'start-date': 'yesterday',
        'end-date': 'today',
        'metrics': 'ga:pageviews',
        'filters': 'ga:pagePath==/features/'
    }
    apiQuery = gapi.client.analytics.data.ga.get(params)
    apiQuery.execute(handleCoreReportingResults);
}

function handleCoreReportingResults(results) {
    if (!results.error) {
        if (results.rows && results.rows.length)
            console.log(results.rows[0][0]);
    } else {
        alert('Something broke: ' + results.message);
    }
}

Add to settings tab with something like

$('#settings ul[class="objects"]').append(
  '<li class="object"><h2><label>Analytics</label></h2><fieldset></fieldset></li>'
)

Access the path of the page currently being edited with

$('a[class="status-tag primary"]').attr('href')
@SalahAdDin
Copy link

Is there a setting for config files or some like it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants