How to save URL parameters

edited August 2017 in Questions
Hi there!

I'm using oneall social plugin on my WordPress site essentially to register new user trial accounts to my saas business.

To register for the trial the user would be able to choose from 2 options:

- sign in via a custom form, or
- sign in via oneall social plugin (facebook & linkedin)

When the user chose to register via the custom form, he will be asked to enter a corporate email and his name. But there are some hidden fields that we are using to save utm_source, utm_medium, utm_campaign and some other fields, so we can keep tracking of the channels and campaigns that are converting.

The code looks something similar to this:

// First whe run a code to parse the url and then we
// pass it to some variables
var source = getParameterByName('utm_source');
var medium = getParameterByName('utm_medium');
var campaign = getParameterByName('utm_campaign');
// And then we pass the values of variables to the respective hidden fields
document.getElementsByName("field[13]")[0].value = medium;
document.getElementsByName("field[14]")[0].value = source;
document.getElementsByName("field[15]")[0].value = campaign;

This is working great.

So now my question is this: How can I save those same parameters when users chose to sign in via oneall plugin?

Without that info, I can't have any clue from where that user is coming from and which campaign generated the lead.

This is a WordPress site, using the oneall social plugin and some javascript to deal with the custom form fields.

Regards!

Answers

  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited August 2017
    Hello,

    the easiest solution would be to manually embed the icons.

    Here an example:

    <div id="social_login_container"></div> <script data-cfasync="false" type="text/javascript"> var source = getParameterByName('utm_source'); var medium = getParameterByName('utm_medium'); var campaign = getParameterByName('utm_campaign'); // ============== CUSTOM START var callback_uri = window.location.href; callback_uri += ((window.location.href.split('?')[1] ? '&amp;': '?') + 'campaign=' + encodeURIComponent (campaign)); callback_uri += ('&amp;medium=' + encodeURIComponent (medium)); callback_uri += ('&amp;source=' + encodeURIComponent (source)); var _oneall = _oneall || []; _oneall.push(['social_login', 'set_providers', ['facebook', 'linkedin']]); _oneall.push(['social_login', 'set_callback_uri', callback_uri]); _oneall.push(['social_login', 'do_render_ui', 'social_login_container']); // ============== CUSTOM END </script>

    Simply add the div to the html your page and the CUSTOM block to your existing JS.
  • Hey Claude!
    Thank you for this. I will try that code on my site to see if it will work.
    BTW how do you guys properly test your implementations on OneAll?
    I just have one facebook account, and I already used it to register on my site using the OneAll plugin...
    So is there a way I can delete this account so I can use it to test as many times I want?
    Since the social icons does not show for users that are already registered at OneAll, I didn't find out yet, a proper way to test my implementations, using the only social account I have.
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    Hello,

    we carefully test all of our implementations on a local test server.

    You do not need to remove your Facebook account.
    You can simply create a new site in your OneAll account.
    Then you setup another Facebook app especially for that site.

    Now you have a separate setup for your tests.

    In WordPress our Social Login is not displayed for users that are already logged in.
    This makes sense, as the plugin is intended to allow users to login.

    No need to display the option if the user is already logged in.

    You can simply logout from WordPress to see your implementation.
  • Still regarding on this matter...

    Now I discovered that you guys have a Beta integration with Zapier, and this could save me some time.

    I already setup the connection to OneAll inside Zapier.

    But I still need to save the url parameters, so how can I send the medium, source and campaign parameters somehow to Zapier?

    Even if I need to send all at once using a single field, it will be ok. I could parse it inside Zapier.

    Best regards,

    Shidartha
  • Still nothing from Zapier?
  • Claude_SchlesserClaude_SchlesserAdministratorOneAll Team
    edited October 2017
    Not yet, but we might a far better solution.

    Our User Storage now allows to save custom data:
    http://docs.oneall.com/api/resources/storage/users/update-user/

    Whenever a user logs in with a social network, you could simply add any data you like to the user profile in your OneAll site.

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.