wonderpush / gtm-wonderpush-trackevent

Google Tag Manager Template for WonderPush − Track event. High volume, fast delivery and full-featured starting €1/month.
https://docs.wonderpush.com/docs/web-push-notifications-google-tag-manager
Apache License 2.0
0 stars 0 forks source link

Couple suggestions for the set of tags submitted #1

Open philpott opened 4 years ago

philpott commented 4 years ago

Couple suggestions for the set of tags submitted...

  1. Merging tags to not have to message about running the install tag.

It would be a simpler user experience if you combine the inject script call into both of your core templates (tagging and track event). The way it's currently implemented the user will have to manually guarantee that the install tag by hand or using a tag sequence on all WonderPush tagging and track event calls.

If you wanted to you could use copyFromWindow to verify if the object exists before sending the injectScript request.

  1. Use createQueue or createArgumentsQueue to create or bind to the existing WonderPush array.

You can use createQueue or createArgumentsQueue to bind to your array. This will simplify the code but is equivalent to what is currently implemented with setInWindow/callInWindow.

Thanks Michael

ofavre commented 4 years ago

Hi Michael,

Thanks for the suggestions. I've used createQueue as per your second suggestion, code and permissions lost a few lines, that's good.

However we do not want to merge the tags as per your first suggestion for multiple reasons:

As for offering more options in the gtm-wonderpush-integrate tag, in addition to user-friendly checkboxes, we would need to offer an advanced field for the tag integrator to put a raw JSON input to enable him to totally control initialization options. However I could not find a way to parse a JSON input. Asking permission on JSON and JSON.parse is invalid as they are "window built-in variables", but calling them directly in the code doesn't work either because they are undefined. How could I parse JSON? Do you have another suggestion?

Best, Olivier

ofavre commented 4 years ago

Hi @philpott,

Thank you for publishing our tags in the community template gallery.

Do you have any help about how to parse JSON in a GTM template?

However I could not find a way to parse a JSON input. Asking permission on JSON and JSON.parse is invalid as they are "window built-in variables", but calling them directly in the code doesn't work either because they are undefined. How could I parse JSON? Do you have another suggestion?

Best, Olivier

philpott commented 4 years ago

I checked with my team and we currently don't support parsing JSON but we do have a backlog of API's that we would like to submit that I can add this to. Could you give me a use case for a JSON parsing API that I can add to the backlog so we can prioritize work.

Thanks Michael

On Sat, Dec 14, 2019, 3:01 AM Olivier Favre notifications@github.com wrote:

Hi @philpott https://github.com/philpott,

Thank you for publishing our tags in the community template gallery.

Do you have any help about how to parse JSON in a GTM template?

However I could not find a way to parse a JSON input. Asking permission on JSON and JSON.parse is invalid as they are "window built-in variables", but calling them directly in the code doesn't work either because they are undefined. How could I parse JSON? Do you have another suggestion?

Best, Olivier

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wonderpush/gtm-wonderpush-trackevent/issues/1?email_source=notifications&email_token=ACZ2WWL3ELELDEJAFWP7XVLQYS4JJA5CNFSM4JW36KB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4ACAA#issuecomment-565707008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZ2WWJFO7VTGD35NECFC7DQYS4JJANCNFSM4JW36KBQ .

ofavre commented 4 years ago

Hi @philpott,

Our SDK supports several initialization parameters, given as a JavaScript object. Some values accept nested objects. The typing of values is important.

We can provide a UI that breaks down the most important of these options into something easy for the user, but it would never match the flexibility of providing your own JSON value.

Best, Olivier