npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sunrise-integration/google-optimize

v1.0.1

Published

Google Optimize integration for Shogun Frontend.

Downloads

1

Readme

Google Optimize

Google Optimize integration for Shogun Frontend.

Personalize your site. Reap the rewards.

Google Optimize website →

Google Optimize developer docs →

Installation

yarn add @sunrise-integration/google-optimize

npm install @sunrise-integration/google-optimize

Requirements

You will need a Google Analytics, Google Tag Manager and Google Optimize account

  1. Follow these instructions to set up your Google Tag Manager account. Do not install the script, it will be injected through the @frontend-sdk/google-tag-manager package

  2. Follow these instructions to set up your Google Analytics account with a property and data stream

  3. Go to Tagging Instructions -> Use existing on-page tag -> Google Tag Manager and follow the instructions.

  4. Configure a Google Optimize experiment to acquire a optimizeContainerId

Usage

  1. Initialize Google Optimize with the useGoogleOptimize hook by passing your optimizeContainerID provided by Google Optimize.

  2. Events can be fired with the useGoogleOptimizeEvent(eventName = 'optimize.activate', options = {}) hook. You may pass a custom event name otherwise the optimize.activate event will be fired.

Instantiate Google Tag Manager and Google Optimize:

import {useGoogleTagManager} from '@frontend-sdk/google-tag-manager'
import {useGoogleOptimize} from '@sunrise-integration/google-optimize'

const App = () => {
    const optimizeContainerId = 'OPT-XXXXXXX';
    useGoogleTagManager({
        containerId: 'GTM-XXXXXXX',
        gaSessionId: `${new Date().getTime()}`,
        optimizeContainerId: optimizeContainerId,
    })
    useGoogleOptimize(optimizeContainerId);
    return <div>...</div>
}

Firing the default optimize.activate event on a page:

import {useGoogleOptimizeEvent} from '@sunrise-integration/google-optimize'

const Page = () => {
    useGoogleOptimizeEvent(); // By Default it will call optimize.activate event
    return <div>...</div>
}

Firing a custom event named custom-event-name with options on a page:

import {useGoogleOptimizeEvent} from '@sunrise-integration/google-optimize'

const Page = () => {
    useGoogleOptimizeEvent('custom-event-name', {
      'experiment_id': 'experimentId',
      'variant_id': 'variationId',
      'send_to': 'GA_MEASUREMENT_ID',
    });
    return <div>...</div>
}