Ze0nC / GoogleAnalyticsPublishPlugin

Google Analytics Plugin for Publish

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoogleAnalyticsPublishPlugin

A plugin for enabling Google Analytics when using Publish](https://github.com/johnsundell/publish).

Note

Important This plugin does not work on official Publish yet.

Rather, it needs a forked version of Publish by now.

Use at your own risk.

Installation

Add GoogleAnalyticsPublishPlugin to your package.

let package = Package(
    ...
    dependencies: [
    .package(url: "https://github.com/Ze0nC/GoogleAnalyticsPublishPlugin", .branch("master"))
    ],
    targets: [
        .target(
            ...
            dependencies: [
                ...
                "GoogleAnalyticsPublishPlugin"
            ]
        )
    ]
    ...
)

Usage

  1. Get your Tracking ID for your site at Google Analytics.

  2. Add the plugin with Tracking ID to your build pipeline (before HTML files are generated).

import GoogleAnalyticsPublishPlugin
...
try MyWebsite().publish(using: [
    .addMarkdownFiles(),
    .installPlugin(.googleAnalytics(trackingID: "YOUR-TRACKING-ID")),
    ...
    .generateHTML(withTheme: .foundation),
    ...
])

Done!

License

MIT License

About

Google Analytics Plugin for Publish

License:MIT License


Languages

Language:Swift 100.0%