Skip to content

Commit

Permalink
Merge pull request #69 from anpolimus/telemetry
Browse files Browse the repository at this point in the history
Virtual tracking
  • Loading branch information
hamrant authored Jul 28, 2020
2 parents fb89a18 + 1cee488 commit ea4f604
Show file tree
Hide file tree
Showing 46 changed files with 1,727 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="openy_gated_content">
<description>PHP Code Sniffer configuration for Open Y Gated Content.</description>
<description>PHP Code Sniffer configuration for Open Y Virtual Y Content.</description>
<arg name="colors" />
<arg value="s" />
<rule ref="Drupal">
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Open Y Gated content
# Open Y Virtual Y content

## Development

Expand Down
4 changes: 2 additions & 2 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Table of contents

* [Open Y Gated content](README.md)
* [Open Y Virtual Y content](README.md)
* [modules](modules/README.md)
* [openy\_gc\_auth](modules/openy_gc_auth/README.md)
* [modules](modules/openy_gc_auth/modules/README.md)
* [README](modules/openy_gc_auth/modules/openy_gc_auth_custom.md)
* [Open Y Gated Content Personify SSO Auth.][1]
* [Open Y Virtual Y Content Personify SSO Auth.][1]
* [README](modules/openy_gc_auth/modules/openy_gc_auth_daxko_sso.md)
* [js](js/README.md)
* [gated-content](js/gated-content.md)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ymcatwincities/openy_gated_content",
"description": "Open Y Gated Content",
"description": "Open Y Virtual Y Content",
"type": "drupal-module",
"require": {
"drupal/recurring_events": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ id: paragraph.gated_content_login.field_link_to_gated_content_app
field_name: field_link_to_gated_content_app
entity_type: paragraph
bundle: gated_content_login
label: 'Link to Gated Content App'
label: 'Link to Virtual Y Content App'
description: 'The page user sent after signed in.'
required: true
translatable: false
Expand Down
4 changes: 2 additions & 2 deletions config/install/paragraphs.paragraphs_type.gated_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ langcode: en
status: true
dependencies: { }
id: gated_content
label: 'Gated Content'
label: 'Virtual Y Content'
icon_uuid: null
description: 'Open Y Gated content'
description: 'Open Y Virtual Y content'
behavior_plugins: { }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ langcode: en
status: true
dependencies: { }
id: gated_content_login
label: 'Gated Content Login'
label: 'Virtual Y Content Login'
icon_uuid: null
description: ''
behavior_plugins: { }
4 changes: 2 additions & 2 deletions js/gated-content/dist/gated-content.umd.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions js/gated-content/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import App from './GatedContent.vue';
import router from './router';
import store from './store';
import filters from './filters';
import Log from './plugins/log';

Vue.use(Log);

Vue.config.productionTip = false;

Expand Down
34 changes: 34 additions & 0 deletions js/gated-content/src/plugins/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import store from '@/store';

const Log = {
// eslint-disable-next-line no-unused-vars
install(Vue, options) {
// eslint-disable-next-line no-param-reassign
Vue.prototype.$log = {
trackEventLoggedIn(user) {
const event = new CustomEvent('virtual-y-log', {
detail: {
event_type: 'userLoggedIn',
email: 'email' in user ? user.email : 'dummy',
},
});
document.body.dispatchEvent(event);
},
trackEventEntityView(entityType, entityBundle, entityId) {
const user = store.getters.getUser;
const event = new CustomEvent('virtual-y-log', {
detail: {
email: 'email' in user ? user.email : 'dummy',
event_type: 'entityView',
entity_type: entityType,
entity_bundle: entityBundle,
entity_id: entityId,
},
});
document.body.dispatchEvent(event);
},
};
},
};

export default Log;
4 changes: 4 additions & 0 deletions js/gated-content/src/store/modules/auth.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Vue from 'vue';

export default {
state: {
authPlugin: 'dummy',
Expand All @@ -10,6 +12,7 @@ export default {
actions: {
authorize(context, user) {
context.commit('setUser', user);
Vue.prototype.$log.trackEventLoggedIn(user);
},
logout(context) {
context.commit('unsetUser');
Expand Down Expand Up @@ -41,5 +44,6 @@ export default {
isLoggedIn: (state) => state.loggedIn,
authPlugin: (state) => state.authPlugin,
getAppUrl: (state) => state.appUrl,
getUser: (state) => state.user,
},
};
2 changes: 2 additions & 0 deletions js/gated-content/src/views/BlogPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export default {
.then((response) => {
this.blog = this.combine(response.data.data, response.data.included, this.params);
this.loading = false;
}).then(() => {
this.$log.trackEventEntityView('node', 'vy_blog_post', this.blog.attributes.drupal_internal__nid);
})
.catch((error) => {
this.error = true;
Expand Down
2 changes: 2 additions & 0 deletions js/gated-content/src/views/LiveStreamPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export default {
});
}
this.loading = false;
}).then(() => {
this.$log.trackEventEntityView('series', 'live_stream', this.video.attributes.drupal_internal__id);
})
.catch((error) => {
this.error = true;
Expand Down
2 changes: 2 additions & 0 deletions js/gated-content/src/views/VideoPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export default {
.then((response) => {
this.video = this.combine(response.data.data, response.data.included, this.params);
this.loading = false;
}).then(() => {
this.$log.trackEventEntityView('node', 'gc_video', this.video.attributes.drupal_internal__nid);
})
.catch((error) => {
this.error = true;
Expand Down
2 changes: 2 additions & 0 deletions js/gated-content/src/views/VirtualMeetingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ export default {
});
}
this.loading = false;
}).then(() => {
this.$log.trackEventEntityView('series', 'virtual_meeting', this.video.attributes.drupal_internal__id);
})
.catch((error) => {
this.error = true;
Expand Down
8 changes: 4 additions & 4 deletions modules/openy_gc_auth/modules/openy_gc_auth_custom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ drush mim gc_auth_custom_users --sync=TRUE

### How to upload source file

You can upload source file directly t0 private://gc_auth/import
File name should be gc_auth_custom_users.csv
You can upload source file directly to `private://gc_auth/import/gc_auth_custom_users.csv`.

Or you can upload file from UI in migration group settings, for example:
- /admin/structure/migrate/manage/gc_auth
OR

You can upload file from the Drupal UI in Migration Group settings at `/admin/structure/migrate/manage/gc_auth`.

## Notes:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: 'Provides Open Y Virtual YMCA custom authentication provider based
package: Open Y Virtual YMCA
version: 0.1
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- drupal:migrate
- drupal:migrate_source_csv
Expand Down
2 changes: 1 addition & 1 deletion modules/openy_gc_auth/modules/openy_gc_auth_daxko_sso.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ It consists of Daxko SSO plugin and requires

5. Set Daxko SSO as your main authorization plugin

at the Gated Content settings: /admin/openy/openy-gc-auth/settings
at the Virtual Y Content settings: /admin/openy/openy-gc-auth/settings

## I need help.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: 'Daxko integration for Virtual YMCA'
package: Open Y Virtual YMCA
version: 0.1
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- drupal:daxko_sso
- drupal:openy_gc_auth
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ description: 'Provides Open Y Virtual YMCA dummy authentication provider.'
package: Open Y Virtual YMCA
version: 0.1
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- drupal:openy_gc_auth
4 changes: 2 additions & 2 deletions modules/openy_gc_auth/modules/openy_gc_auth_personify.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Open Y Gated Content Personify SSO Auth.
# Open Y Virtual Y Content Personify SSO Auth.

Provides Open Y Gated Content Personify SSO authentication provider
Provides Open Y Virtual Y Content Personify SSO authentication provider
based on Personify module.

## Integration with Personify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: 'Provides Open Y Virtual YMCA Personify SSO authentication provider
package: Open Y Virtual YMCA
version: 0.1
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- drupal:openy_gc_auth
- drupal:personify
1 change: 1 addition & 0 deletions modules/openy_gc_auth/openy_gc_auth.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ description: 'Provides Open Y Virtual YMCA authentication provider.'
package: Open Y Virtual YMCA
version: 0.1
core: 8.x
core_version_requirement: ^8 || ^9
1 change: 1 addition & 0 deletions modules/openy_gc_demo/openy_gc_demo.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: 'Provides a Landing page node for development purposes.'
package: Open Y Virtual YMCA
version: 0.1
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- drupal:migrate
- drupal:openy_migrate
Expand Down
Loading

0 comments on commit ea4f604

Please sign in to comment.